X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jcc.c;h=b199c47acf9f5ed2d8ca356f106e984c4d40d403;hp=8ab7f872e03d02b86d52137f3b4e5390910481ac;hb=9cd20df9f8634795b5f7577c698c040b20066351;hpb=d6f6d40eb51a7a7f491c5c027f83bbd7f44c009f diff --git a/jcc.c b/jcc.c index 8ab7f872..b199c47a 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.441 2016/02/26 12:29:38 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.445 2016/05/25 10:51:10 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -1678,6 +1678,12 @@ static jb_err receive_client_request(struct client_state *csp) } } +#ifdef FEATURE_CLIENT_TAGS + /* XXX: If the headers were enlisted sooner, passing csp would do. */ + set_client_address(csp, headers); + get_tag_list_for_client(csp->client_tags, csp->client_address); +#endif + /* * Determine the actions for this URL */ @@ -1848,9 +1854,6 @@ static void chat(struct client_state *csp) http = csp->http; -#if FEATURE_CLIENT_TAGS - get_tag_list_for_client(csp->client_tags, csp->ip_addr_str); -#endif if (receive_client_request(csp) != JB_ERR_OK) { return; @@ -2810,8 +2813,6 @@ static void chat(struct client_state *csp) *********************************************************************/ static void prepare_csp_for_next_request(struct client_state *csp) { - unsigned int toggled_on_flag_set = (0 != (csp->flags & CSP_FLAG_TOGGLED_ON)); - csp->content_type = 0; csp->content_length = 0; csp->expected_content_length = 0; @@ -2824,6 +2825,7 @@ static void prepare_csp_for_next_request(struct client_state *csp) destroy_list(csp->tags); #ifdef FEATURE_CLIENT_TAGS destroy_list(csp->client_tags); + freez(csp->client_address); #endif free_current_action(csp->action); if (NULL != csp->fwd) @@ -2833,7 +2835,9 @@ static void prepare_csp_for_next_request(struct client_state *csp) } /* XXX: Store per-connection flags someplace else. */ csp->flags = (CSP_FLAG_ACTIVE | CSP_FLAG_REUSED_CLIENT_CONNECTION); - if (toggled_on_flag_set) +#ifdef FEATURE_TOGGLE + if (global_toggle_state) +#endif /* def FEATURE_TOGGLE */ { csp->flags |= CSP_FLAG_TOGGLED_ON; } @@ -3988,6 +3992,12 @@ static void listen_loop(void) "Waiting for the next client connection. Currently active threads: %d", active_threads); + /* + * This config may be outdated, but for accept_connection() + * it's fresh enough. + */ + csp->config = config; + if (!accept_connection(csp, bfds)) { log_error(LOG_LEVEL_CONNECT, "accept failed: %E"); @@ -4044,9 +4054,11 @@ static void listen_loop(void) if (block_acl(NULL,csp)) { log_error(LOG_LEVEL_CONNECT, - "Connection from %s on socket %d dropped due to ACL", csp->ip_addr_str, csp->cfd); + "Connection from %s on %s (socket %d) dropped due to ACL", + csp->ip_addr_str, csp->listen_addr_str, csp->cfd); close_socket(csp->cfd); freez(csp->ip_addr_str); + freez(csp->listen_addr_str); freez(csp_list); continue; } @@ -4062,6 +4074,7 @@ static void listen_loop(void) strlen(TOO_MANY_CONNECTIONS_RESPONSE)); close_socket(csp->cfd); freez(csp->ip_addr_str); + freez(csp->listen_addr_str); freez(csp_list); continue; }