cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Connection close with HTTP proxies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 9 Dec 2013 13:53:21 +0100 (CET)

On Wed, 4 Dec 2013, Michael-O wrote:

> I am investigating an issue with HTTP proxy and asking myself why curl
> behaves the way it behaves. I am using curl 7.34.0 from master and this is
> my usecase:
>
> I am retrieving a resource [1] over Subversion 1.8.x and the included serf
> 1.3.x dies in an endless loop [2]. Examing in Wireshark reveils that a
> CONNECT happens, the proxy (MS Forefront TMG) responds with 407 AND
> Connection: close. The client aborts the CONNECT, closes the TCP connection
> and starts over and over again. Doing the same with curl works flawlessly.
>
> So my question is: Why does curl simply retain the connection although
> closed by the proxy server and keeps going? (Trace files available). I
> presume that curl's behavior is correct but why?

Because "Connection: close" means that the connection will/should get closed
after the response has been handled and 200 means OK, so libcurl will handle
the response, which in a the CONNECT case means a full tunnel.

See lib/http_proxy.c:Curl_proxyCONNECT() for implementation details.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-12-09