From ff17431b02de8fecdabf536ee6aa03d385eb80b9 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 19 Feb 2009 18:09:32 +0000 Subject: [PATCH] Unbreak build without FEATURE_CONNECTION_KEEP_ALIVE. Noticed by David. --- jcc.c | 66 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/jcc.c b/jcc.c index 509be632..c193898d 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.223 2009/02/09 21:21:16 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.224 2009/02/14 15:32:04 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,10 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.223 2009/02/09 21:21:16 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.224 2009/02/14 15:32:04 fabiankeil + * Add the request URL to the timeout message in chat(). + * Suggested by Lee. + * * Revision 1.223 2009/02/09 21:21:16 fabiankeil * Now that init_log_module() is called earlier, call show_version() * later on from main() directly so it doesn't get called for --help @@ -2168,8 +2172,38 @@ static int server_response_is_complete(struct client_state *csp, size_t content_ return (content_length_known && ((0 == csp->expected_content_length) || (csp->expected_content_length <= content_length))); } + + +/********************************************************************* + * + * Function : wait_for_alive_connections + * + * Description : Waits for alive connections to timeout. + * + * Parameters : N/A + * + * Returns : N/A + * + *********************************************************************/ +static void wait_for_alive_connections() +{ + int connections_alive = close_unusable_connections(); + + while (0 < connections_alive) + { + log_error(LOG_LEVEL_CONNECT, + "Waiting for %d connections to timeout.", + connections_alive); + sleep(60); + connections_alive = close_unusable_connections(); + } + + log_error(LOG_LEVEL_CONNECT, "No connections to wait for left."); + +} #endif /* FEATURE_CONNECTION_KEEP_ALIVE */ + /********************************************************************* * * Function : mark_server_socket_tainted @@ -3241,6 +3275,7 @@ static void chat(struct client_state *csp) csp->content_length = byte_count; } +#ifdef FEATURE_CONNECTION_KEEP_ALIVE if ((csp->flags & CSP_FLAG_CONTENT_LENGTH_SET) && (csp->expected_content_length != byte_count)) { @@ -3249,40 +3284,13 @@ static void chat(struct client_state *csp) byte_count, csp->expected_content_length); mark_server_socket_tainted(csp); } +#endif log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d", csp->ip_addr_str, http->ocmd, csp->content_length); } -/********************************************************************* - * - * Function : wait_for_alive_connections - * - * Description : Waits for alive connections to timeout. - * - * Parameters : N/A - * - * Returns : N/A - * - *********************************************************************/ -static void wait_for_alive_connections() -{ - int connections_alive = close_unusable_connections(); - - while (0 < connections_alive) - { - log_error(LOG_LEVEL_CONNECT, - "Waiting for %d connections to timeout.", - connections_alive); - sleep(60); - connections_alive = close_unusable_connections(); - } - - log_error(LOG_LEVEL_CONNECT, "No connections to wait for left."); - -} - /********************************************************************* * * Function : serve -- 2.39.2