From 735b418b180f02974e7bab27d45078d44abf7866 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 2 Nov 2008 18:40:34 +0000 Subject: [PATCH] If we received a different amount of data than we expected, log a warning and make sure the server socket isn't reused. --- jcc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jcc.c b/jcc.c index 4b71bccb..6cee5d4b 100644 --- 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); } -- 2.39.2