X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=jcc.c;h=31952a1bf6e186d49c854120cb2341b24c317658;hb=03cc03de9fa8f332b1400f12ff884a8dc7e4aa6a;hp=35d4a321c0fbb84c6b393c1c801fd6e264371417;hpb=d19ac9846ff30aaf523f4d55202a35db70d447a6;p=privoxy.git diff --git a/jcc.c b/jcc.c index 35d4a321..31952a1b 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.323 2010/07/21 14:32:00 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.324 2010/07/21 14:35:09 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -1789,9 +1789,14 @@ static void chat(struct client_state *csp) && ((csp->iob->eod - csp->iob->cur) >= 5) && !memcmp(csp->iob->eod-5, "0\r\n\r\n", 5)) { + /* + * XXX: This check should be obsolete now, + * but let's wait a while to be sure. + */ log_error(LOG_LEVEL_CONNECT, - "Looks like we read the last chunk together with " - "the server headers. We better stop reading."); + "Looks like we got the last chunk together with " + "the server headers but didn't detect it earlier. " + "We better stop reading."); byte_count = (unsigned long long)(csp->iob->eod - csp->iob->cur); csp->expected_content_length = byte_count; csp->flags |= CSP_FLAG_CONTENT_LENGTH_SET; @@ -2294,6 +2299,19 @@ static void chat(struct client_state *csp) log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header"); } + if ((csp->flags & CSP_FLAG_CHUNKED) + && !(csp->flags & CSP_FLAG_CONTENT_LENGTH_SET) + && ((csp->iob->eod - csp->iob->cur) >= 5) + && !memcmp(csp->iob->eod-5, "0\r\n\r\n", 5)) + { + log_error(LOG_LEVEL_CONNECT, + "Looks like we got the last chunk together with " + "the server headers. We better stop reading."); + byte_count = (unsigned long long)(csp->iob->eod - csp->iob->cur); + csp->expected_content_length = byte_count; + csp->flags |= CSP_FLAG_CONTENT_LENGTH_SET; + } + csp->server_connection.response_received = time(NULL); if (crunch_response_triggered(csp, crunchers_light))