Cosmetics for the last commit: Don't watch out for
authorFabian Keil <fk@fabiankeil.de>
Thu, 27 Nov 2008 09:44:04 +0000 (09:44 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 27 Nov 2008 09:44:04 +0000 (09:44 +0000)
the last chunk if the content isn't chunk-encoded or
if we already determined the content length previously.

jcc.c

diff --git a/jcc.c b/jcc.c
index 4103922..b7dd69a 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.207 2008/11/25 17:25:16 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.208 2008/11/26 18:24:17 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,11 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.207 2008/11/25 17:25:16 fabiankeil Exp $"
  *
  * Revisions   :
  *    $Log: jcc.c,v $
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.208  2008/11/26 18:24:17  fabiankeil
+ *    Recognize that the server response is complete if the
+ *    last chunk is read together with the server headers.
+ *    Reported by Lee.
+ *
  *    Revision 1.207  2008/11/25 17:25:16  fabiankeil
  *    Don't convert the client-header list to text until we need to.
  *
  *    Revision 1.207  2008/11/25 17:25:16  fabiankeil
  *    Don't convert the client-header list to text until we need to.
  *
@@ -2667,7 +2672,9 @@ static void chat(struct client_state *csp)
       FD_SET(csp->sfd, &rfds);
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
       FD_SET(csp->sfd, &rfds);
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
-      if (((csp->iob->eod - csp->iob->cur) >= 5)
+      if ((csp->flags & CSP_FLAG_CHUNKED)
+         && !(csp->flags & CSP_FLAG_CONTENT_LENGTH_SET)
+         && ((csp->iob->eod - csp->iob->cur) >= 5)
          && !memcmp(csp->iob->eod-5, "0\r\n\r\n", 5))
       {
          log_error(LOG_LEVEL_CONNECT,
          && !memcmp(csp->iob->eod-5, "0\r\n\r\n", 5))
       {
          log_error(LOG_LEVEL_CONNECT,