From: Fabian Keil Date: Sat, 11 Oct 2008 14:58:00 +0000 (+0000) Subject: In case of chunk-encoded content, stop reading if X-Git-Tag: v_3_0_11~217 X-Git-Url: http://www.privoxy.org/gitweb/%40proxy-info-url%40?a=commitdiff_plain;h=ac7c5278701033c844c2c1a2fc059d822375b250;p=privoxy.git In case of chunk-encoded content, stop reading if the buffer looks like it ends with the last chunk. --- diff --git a/jcc.c b/jcc.c index 38f66e73..99b72a65 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.188 2008/10/09 18:21:41 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.189 2008/10/11 09:53:00 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,10 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.188 2008/10/09 18:21:41 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.189 2008/10/11 09:53:00 fabiankeil + * Let server_response_is_complete() deal properly with + * content that is neither buffered nor read all at once. + * * Revision 1.188 2008/10/09 18:21:41 fabiankeil * Flush work-in-progress changes to keep outgoing connections * alive where possible. Incomplete and mostly #ifdef'd out. @@ -2612,6 +2616,19 @@ static void chat(struct client_state *csp) } #ifdef FEATURE_CONNECTION_KEEP_ALIVE + if (csp->flags & CSP_FLAG_CHUNKED) + { + if ((len > 5) && !memcmp(buf+len-5, "0\r\n\r\n", 5)) + { + /* XXX: this is a temporary hack */ + log_error(LOG_LEVEL_CONNECT, + "Looks like we reached the end of the last chunk: " + "%d %d %d %d %d. We better stop reading.", + buf[len-5], buf[len-4], buf[len-3], buf[len-2], buf[len-1]); + csp->expected_content_length = byte_count + len; + csp->flags |= CSP_FLAG_CONTENT_LENGTH_SET; + } + } reading_done: #endif /* FEATURE_CONNECTION_KEEP_ALIVE */