X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=jcc.c;h=32e6f0d8449dd7d01c16978871668cc611c6292c;hb=0c556e7b91320783f6ff77d63053bc95bd1d116a;hp=6757ad269928e6511a69909a73a71129992b345c;hpb=b6b62a7fa13e2479290ff1784b5f2f1318fae801;p=privoxy.git diff --git a/jcc.c b/jcc.c index 6757ad26..32e6f0d8 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.383 2012/07/23 12:55:25 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.387 2012/09/04 08:37:51 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -6,7 +6,7 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.383 2012/07/23 12:55:25 fabiankeil Exp $" * Purpose : Main file. Contains main() method, main loop, and * the main connection-handling function. * - * Copyright : Written by and Copyright (C) 2001-2010 the + * Copyright : Written by and Copyright (C) 2001-2012 the * Privoxy team. http://www.privoxy.org/ * * Based on the Internet Junkbuster originally written @@ -661,6 +661,34 @@ static const char *crunch_reason(const struct http_response *rsp) } +/********************************************************************* + * + * Function : log_applied_actions + * + * Description : Logs the applied actions if LOG_LEVEL_ACTIONS is + * enabled. + * + * Parameters : + * 1 : actions = Current action spec to log + * + * Returns : Nothing. + * + *********************************************************************/ +static void log_applied_actions(const struct current_action_spec *actions) +{ + /* + * The conversion to text requires lots of memory allocations so + * we only do the conversion if the user is actually interested. + */ + if (debug_level_is_enabled(LOG_LEVEL_ACTIONS)) + { + char *actions_as_text = actions_to_line_of_text(actions); + log_error(LOG_LEVEL_ACTIONS, "%s", actions_as_text); + freez(actions_as_text); + } +} + + /********************************************************************* * * Function : send_crunch_response @@ -705,6 +733,7 @@ static void send_crunch_response(const struct client_state *csp, struct http_res status_code[3] = '\0'; /* Log that the request was crunched and why. */ + log_applied_actions(csp->action); log_error(LOG_LEVEL_CRUNCH, "%s: %s", crunch_reason(rsp), http->url); log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" %s %u", csp->ip_addr_str, http->ocmd, status_code, rsp->content_length); @@ -1425,6 +1454,12 @@ static jb_err parse_client_request(struct client_state *csp) /* Assume persistence until further notice */ csp->flags |= CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE; } + + if (csp->http->ssl == 0) + { + csp->expected_client_content_length = get_expected_content_length(csp->headers); + verify_request_length(csp); + } #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */ err = sed(csp, FILTER_CLIENT_HEADERS); @@ -1455,13 +1490,6 @@ static jb_err parse_client_request(struct client_state *csp) return JB_ERR_PARSE; } -#ifdef FEATURE_CONNECTION_KEEP_ALIVE - if (csp->http->ssl == 0) - { - verify_request_length(csp); - } -#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */ - return JB_ERR_OK; } @@ -1602,6 +1630,7 @@ static void chat(struct client_state *csp) return; } + log_applied_actions(csp->action); log_error(LOG_LEVEL_GPC, "%s%s", http->hostport, http->path); if (fwd->forward_host) @@ -2478,6 +2507,9 @@ static void serve(struct client_state *csp) #endif /* def FEATURE_CONNECTION_SHARING */ int continue_chatting = 0; + log_error(LOG_LEVEL_CONNECT, "Accepted connection from %s on socket %d", + csp->ip_addr_str, csp->cfd); + do { unsigned int latency; @@ -3525,12 +3557,6 @@ static void listen_loop(void) freez(csp_list); continue; } - else - { - log_error(LOG_LEVEL_CONNECT, - "accepted connection from %s on socket %d", - csp->ip_addr_str, csp->cfd); - } csp->flags |= CSP_FLAG_ACTIVE; csp->server_connection.sfd = JB_INVALID_SOCKET;