cURL / Mailing Lists / curl-library / Single Mail


Re: CURLOPT_HTTP_VERSION doesn't work?

From: Dan Fandrich <>
Date: Tue, 6 Jan 2009 22:02:27 -0800

On Tue, Jan 06, 2009 at 06:11:03PM -0500, A. Craig West wrote:
> I used the use_http_1_1 function that was already in the code, as it
> makes sense in this case too. From what I can tell, it uses 1.1 or 1.0
> if the user has explicitly set that version as an option, otherwise,
> it will use the version that the proxy server has claimed to support.
> I don't see any reasonable cases where this could fail, and it is a
> lot more standards compliant. From what I can determine, CONNECT with
> HTTP/1.0 is part of a proposed extension to http 1.0, as CONNECT
> itself didn't become part of the standard until 1.1, so the servers
> are well within their rights to refuse it. It seems rude, I will
> admit, as there is a general principle of being generous with what you
> accept and strict with what you send...
> It might be worth changing the code to use 1.0 if the server is
> already claiming to be 1.0, even if the setting is 1.1, but I am
> pretty sure the connection is doomed to fail in that case

The fundamental difference between this and a regular HTTP proxy is that
a proxytunnel CONNECT is a completely separate operation from the HTTP
request contained within the tunnel. Overloading the regular HTTP version
number for this is doubling the meaning of CURLOPT_HTTP_VERSION. The
CONNECT version number can/could/should have an independent version number
to the contained request, in the same way that you can choose the SOCKS
version number separately (with CURLOPT_PROXYTYPE) from the HTTP request
carried over the SOCKS connection. In fact, you could compatibly create a
new CURLOPT_PROXYTYPE enumerated type for this (although that may not be the
cleanest place).

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2009-01-07