mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Remove redundant buffering in contentline
The contentline analyzer has two code paths that buffer data: * right at the top of DeliverStream * later in DoDeliverOnce However, contentline can be in plain delivery mode, and if so, the buffer resize in DeliverStream does not need to be done just because DeliverStream was passed an 8K data chunk. This was causing contentline to resize it's buffer to fit chunks of HTTP response data. Additionally, the buffer was sized to be 3/2 of the chunk, so an 8K chunk would result in a 12K allocation.
This commit is contained in:
parent
a342090f18
commit
8fc83f5fee
1 changed files with 0 additions and 13 deletions
|
@ -92,19 +92,6 @@ void ContentLine_Analyzer::DeliverStream(int len, const u_char* data,
|
|||
return;
|
||||
}
|
||||
|
||||
if ( buf && len + offset >= buf_len )
|
||||
{ // Make sure we have enough room to accommodate the new stuff.
|
||||
int old_buf_len = buf_len;
|
||||
buf_len = ((offset + len) * 3) / 2 + 1;
|
||||
|
||||
u_char* tmp = new u_char[buf_len];
|
||||
for ( int i = 0; i < old_buf_len; ++i )
|
||||
tmp[i] = buf[i];
|
||||
|
||||
delete [] buf;
|
||||
buf = tmp;
|
||||
}
|
||||
|
||||
DoDeliver(len, data);
|
||||
|
||||
seq += len;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue