From: Fabian Keil Date: Fri, 28 Aug 2009 15:45:18 +0000 (+0000) Subject: Don't miscalculate byte_count when buffering server headers without any complete... X-Git-Tag: v_3_0_15~88 X-Git-Url: http://www.privoxy.org/gitweb/index.html?a=commitdiff_plain;h=50a1fc91b284f03aaa5bab757a5eb8559aea0903;p=privoxy.git Don't miscalculate byte_count when buffering server headers without any complete server header read yet. Likely to fix #2840156 reported by Oliver. --- diff --git a/jcc.c b/jcc.c index 12ff8d27..4b277f4d 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.279 2009/08/19 16:02:53 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.280 2009/08/28 14:42:06 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -2257,7 +2257,14 @@ static void chat(struct client_state *csp) */ long header_offset = csp->iob->cur - header_start; assert(csp->iob->cur >= header_start); - byte_count += (unsigned long long)(len - header_offset); + if (header_offset) + { + /* + * If there's a header offset, we got content + * as well and have to account for it. + */ + byte_count += (unsigned long long)(len - header_offset); + } log_error(LOG_LEVEL_CONNECT, "Continuing buffering headers. " "byte_count: %llu. header_offset: %d. len: %d.", byte_count, header_offset, len);