The last commit was a bit too ambitious, apparently the content
authorFabian Keil <fk@fabiankeil.de>
Sun, 12 Oct 2008 18:35:18 +0000 (18:35 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 12 Oct 2008 18:35:18 +0000 (18:35 +0000)
length adjustment is only necessary if we aren't buffering.

jcc.c

diff --git a/jcc.c b/jcc.c
index 8f4a840..d2ae203 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.192 2008/10/11 18:19:14 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.193 2008/10/12 15:57:35 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,11 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.192 2008/10/11 18:19:14 fabiankeil Exp $"
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.193  2008/10/12 15:57:35  fabiankeil
+ *    Fix content length calculation if we read headers
+ *    and the start of the body at once. Now that we have
+ *    FEATURE_CONNECTION_KEEP_ALIVE, it actually matters.
+ *
  *    Revision 1.192  2008/10/11 18:19:14  fabiankeil
  *    Even more chat() cosmetics.
  *
@@ -2840,16 +2845,6 @@ static void chat(struct client_state *csp)
                   continue;
                }
             }
-            else
-            {
-               /*
-                * XXX: the header lenght should probably
-                * be calculated by get_server_headers().
-                */
-               int header_length = csp->iob->cur - header_start;
-               assert(csp->iob->cur > header_start);
-               byte_count += len - header_length;
-            }
 
             /* Did we actually get anything? */
             if (NULL == csp->headers->first)
@@ -2943,6 +2938,16 @@ static void chat(struct client_state *csp)
 
                byte_count += (size_t)len;
             }
+            else
+            {
+               /*
+                * XXX: the header lenght should probably
+                * be calculated by get_server_headers().
+                */
+               int header_length = csp->iob->cur - header_start;
+               assert(csp->iob->cur > header_start);
+               byte_count += len - header_length;
+            }
 
             /* we're finished with the server's header */