If we received a different amount of data than we expected,
authorFabian Keil <fk@fabiankeil.de>
Sun, 2 Nov 2008 18:40:34 +0000 (18:40 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 2 Nov 2008 18:40:34 +0000 (18:40 +0000)
log a warning and make sure the server socket isn't reused.

jcc.c

diff --git a/jcc.c b/jcc.c
index 4b71bcc..6cee5d4 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.200 2008/10/26 16:53:18 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.201 2008/11/02 16:48:20 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.200 2008/10/26 16:53:18 fabiankeil Exp $"
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.201  2008/11/02 16:48:20  fabiankeil
+ *    Revert revision 1.195 and try again.
+ *
  *    Revision 1.200  2008/10/26 16:53:18  fabiankeil
  *    Fix gcc44 warning.
  *
@@ -3039,6 +3042,15 @@ static void chat(struct client_state *csp)
       csp->content_length = byte_count;
    }
 
+   if ((csp->flags & CSP_FLAG_CONTENT_LENGTH_SET)
+      && (csp->expected_content_length != byte_count))
+   {
+      log_error(LOG_LEVEL_ERROR,
+         "Received %d bytes while expecting %d.",
+         byte_count, csp->expected_content_length);
+      mark_server_socket_tainted(csp);
+   }
+
    log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d",
       csp->ip_addr_str, http->ocmd, csp->content_length);
 }