From 8bca0f79b7baf6fc6c2155a5a1b8599c9245a467 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 4 Sep 2009 18:28:32 +0000 Subject: [PATCH] In chat(), reset byte_count each time we are buffering additional server headers. We otherwise seem to miscalculate it, if we don't get the whole head in two reads or less. This is another attempt to fix #2840156 reported by Olivier. It's not a permanent solution but should do for now. --- jcc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jcc.c b/jcc.c index 4b277f4d..6be58db4 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.280 2009/08/28 14:42:06 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.281 2009/08/28 15:45:18 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -2229,6 +2229,17 @@ static void chat(struct client_state *csp) } header_start = csp->iob->cur; + /* + * Reset the byte_count in case we needed more than + * two reads to get the whole head, in which case the + * current byte_count would be wrong. + * + * XXX: While this is safe, it's only a workaround and + * the real solution is to not get the byte_count wrong + * in the first place. Should be fixed after the next + * stable release. + */ + byte_count = 0; /* Convert iob into something sed() can digest */ if (JB_ERR_PARSE == get_server_headers(csp)) -- 2.39.2