current parsers.c,1.309,1.310

Fabian Keil <[email protected]> Fri, 09 Dec 2016 09:13:21 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1907

Modified Files:
	parsers.c 
Log Message:
Don't add a "Connection" header for CONNECT requests

Explicitly sending "Connection: close" is not necessary and
apparently it causes problems with some forwarding proxies
that will close the connection prematurely.

Reported by Marc Thomas on privoxy-users@:
https://lists.privoxy.org/pipermail/privoxy-users/2016-December/000127.html


Index: parsers.c
===================================================================
RCS file: /cvsroot/ijbswa/current/parsers.c,v
retrieving revision 1.309
retrieving revision 1.310
diff -C2 -d -r1.309 -r1.310
*** parsers.c	30 Apr 2016 10:28:36 -0000	1.309
--- parsers.c	9 Dec 2016 09:13:19 -0000	1.310
***************
*** 3801,3805 ****
   *
   * Description :  Adds a proper "Connection:" header to csp->headers
!  *                unless the header was already present. Called from `sed'.
   *
   * Parameters  :
--- 3801,3806 ----
   *
   * Description :  Adds a proper "Connection:" header to csp->headers
!  *                unless the header was already present or it's a
!  *                CONNECT request. Called from `sed'.
   *
   * Parameters  :
***************
*** 3820,3827 ****
     }
  
  #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"))
     {
--- 3821,3838 ----
     }
  
+    /*
+     * 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)
        && !strcmpic(csp->http->ver, "HTTP/1.1"))
     {


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi