From 50a1fc91b284f03aaa5bab757a5eb8559aea0903 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 28 Aug 2009 15:45:18 +0000 Subject: [PATCH] Don't miscalculate byte_count when buffering server headers without any complete server header read yet. Likely to fix #2840156 reported by Oliver. --- jcc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); -- 2.39.2