From: Fabian Keil Date: Thu, 28 May 2009 18:42:30 +0000 (+0000) Subject: Turn server_proxy_connection_adder() into a nop if the client didn't request keep... X-Git-Tag: v_3_0_13~63 X-Git-Url: http://www.privoxy.org/gitweb/?a=commitdiff_plain;h=dc90a129949f55c0975821f850b778eb87813259;p=privoxy.git Turn server_proxy_connection_adder() into a nop if the client didn't request keep-alive. --- diff --git a/parsers.c b/parsers.c index c03a0902..0ee8ea7d 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.164 2009/05/25 15:42:40 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.165 2009/05/28 17:07:42 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -3389,7 +3389,8 @@ static jb_err server_connection_adder(struct client_state *csp) * Function : server_proxy_connection_adder * * Description : Adds a "Proxy-Connection: keep-alive" header to - * csp->headers. XXX: We should reuse existant ones. + * csp->headers if the client asked for keep-alive. + * XXX: We should reuse existant ones. * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) @@ -3401,8 +3402,15 @@ static jb_err server_connection_adder(struct client_state *csp) static jb_err server_proxy_connection_adder(struct client_state *csp) { static const char proxy_connection_header[] = "Proxy-Connection: keep-alive"; - log_error(LOG_LEVEL_HEADER, "Adding: %s", proxy_connection_header); - return enlist(csp->headers, proxy_connection_header); + jb_err err = JB_ERR_OK; + + if ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)) + { + log_error(LOG_LEVEL_HEADER, "Adding: %s", proxy_connection_header); + err = enlist(csp->headers, proxy_connection_header); + } + + return err; } #endif /* FEATURE_CONNECTION_KEEP_ALIVE */