Skip to content

Commit

Permalink
Merge pull request #1156 from marcioapm/req_size_dos
Browse files Browse the repository at this point in the history
Fix range violation when writing to access log
  • Loading branch information
s-ludwig committed Jun 26, 2015
2 parents 391b44d + b32f7d4 commit 37125b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/vibe/http/log.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@ class HTTPLogger {
string m_format;
const(HTTPServerSettings) m_settings;
InterruptibleTaskMutex m_mutex;
FixedAppender!(const(char)[], 2048) m_lineAppender;
Appender!(char[]) m_lineAppender;
}

this(in HTTPServerSettings settings, string format)
{
m_format = format;
m_settings = settings;
m_mutex = new InterruptibleTaskMutex;
m_lineAppender.reserve(2048);
}

void close() {}

final void log(scope HTTPServerRequest req, scope HTTPServerResponse res)
{
m_mutex.performLocked!({
m_lineAppender.reset();
m_lineAppender.clear();
formatApacheLog(m_lineAppender, m_format, req, res, m_settings);
writeLine(m_lineAppender.data);
});
Expand Down

0 comments on commit 37125b0

Please sign in to comment.