From: Fabian Keil Date: Wed, 26 Nov 2008 18:24:17 +0000 (+0000) Subject: Recognize that the server response is complete if the X-Git-Tag: v_3_0_11~148 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=86a13bf78c7009b325e97819b8ad34f8aef13e8e Recognize that the server response is complete if the last chunk is read together with the server headers. Reported by Lee. --- diff --git a/jcc.c b/jcc.c index b464e46a..41039220 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.206 2008/11/23 17:00:11 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.207 2008/11/25 17:25:16 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.206 2008/11/23 17:00:11 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.207 2008/11/25 17:25:16 fabiankeil + * Don't convert the client-header list to text until we need to. + * * Revision 1.206 2008/11/23 17:00:11 fabiankeil * Some more chat() cosmetics. * @@ -2664,6 +2667,16 @@ static void chat(struct client_state *csp) FD_SET(csp->sfd, &rfds); #ifdef FEATURE_CONNECTION_KEEP_ALIVE + if (((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 read the last chunk together with " + "the server headers. We better stop reading."); + byte_count = (size_t)(csp->iob->eod - csp->iob->cur); + csp->expected_content_length = byte_count; + csp->flags |= CSP_FLAG_CONTENT_LENGTH_SET; + } if (server_body && server_response_is_complete(csp, byte_count)) { log_error(LOG_LEVEL_CONNECT,