curl-users
Re: Connection close with HTTP proxies
Date: Mon, 09 Dec 2013 14:02:48 +0100
Am 2013-12-09 13:53, schrieb Daniel Stenberg:
> 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.
Thanks,
though I did not fully understand the code. Does you answer imply that a
connection is only closed when no continuation is necessary, e.g. not
401/407, 301, etc.?
Mike
-------------------------------------------------------------------
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