-const char parsers_rcs[] = "$Id: parsers.c,v 1.308 2016/02/26 12:31:12 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.309 2016/04/30 10:28:36 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
* Function : client_connection_header_adder
*
* Description : Adds a proper "Connection:" header to csp->headers
- * unless the header was already present. Called from `sed'.
+ * unless the header was already present or it's a
+ * CONNECT request. Called from `sed'.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
return JB_ERR_OK;
}
+ /*
+ * In case of CONNECT requests "Connection: close" is implied,
+ * but actually setting the header has been reported to cause
+ * problems with some forwarding proxies that close the
+ * connection prematurely.
+ */
+ if (csp->http->ssl != 0)
+ {
+ return JB_ERR_OK;
+ }
+
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
&& !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
- && (csp->http->ssl == 0)
&& !strcmpic(csp->http->ver, "HTTP/1.1"))
{
csp->flags |= CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE;