Fix when HTTP header are on several packet

This commit is contained in:
jerome Grandvalet 2021-07-26 15:58:14 +02:00
parent 8cabecec40
commit 83f4903250
2 changed files with 10 additions and 6 deletions

View file

@ -511,9 +511,6 @@ void HTTP_Entity::SubmitAllHeaders()
// in_header should be set to false when SubmitAllHeaders() is called. // in_header should be set to false when SubmitAllHeaders() is called.
ASSERT(! in_header); ASSERT(! in_header);
if (content_length >= 0 )
http_message->SetDeliverySize(content_length);
if ( DEBUG_http ) if ( DEBUG_http )
DEBUG_MSG("%.6f end of headers\n", run_state::network_time); DEBUG_MSG("%.6f end of headers\n", run_state::network_time);
@ -531,6 +528,9 @@ void HTTP_Entity::SubmitAllHeaders()
http_message->content_line->SetCRLFAsEOL(0); http_message->content_line->SetCRLFAsEOL(0);
} }
if (content_length >= 0 )
http_message->SetDeliverySize(content_length);
// The presence of a message-body in a request is signaled by // The presence of a message-body in a request is signaled by
// the inclusion of a Content-Length or Transfer-Encoding // the inclusion of a Content-Length or Transfer-Encoding
// header field in the request's message-headers. // header field in the request's message-headers.

View file

@ -99,11 +99,15 @@ void ContentLine_Analyzer::DeliverStream(int len, const u_char* data,
// If we have parsed all the data of the packet but there is no CRLF at the end // If we have parsed all the data of the packet but there is no CRLF at the end
// Force the process by flushing buffer // Force the process by flushing buffer
if ( delivery_length == 0 && HasPartialLine() ) if ( delivery_length == 0 )
{ {
Weird("No CRLF at the end of the packet"); if (HasPartialLine())
{
Weird("line_terminated_without_CRLF");
DoDeliver(2, (const u_char*) "\r\n"); DoDeliver(2, (const u_char*) "\r\n");
} }
delivery_length = -1;
}
seq += len; seq += len;
} }