cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: fallback from HTTP 1.1 to HTTP 1.0 for multiple curl sessions

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 6 Aug 2014 11:02:08 +0200

On Wed, Aug 06, 2014 at 12:40:54AM +0530, Girish Aher wrote:
> I am using libcurl in a multi-threaded program wherein each thread has its own
> curl session handle as per the documentation. All the sessions talk to the same
> destination web server to upload data over http and they pass through a **HTTP
> 1.0** proxy.
>
> My question here - I understand (and I hope to be right here) that a curl
> connection ascertains from the proxy response that it needs to fallback (from
> the default 1.1) to HTTP 1.0 for further communication on same session handle.
> So, does libcurl maintain some kind of global cache that all the the other
> session handles in the other threads (or connections within the same handle)
> may use and know to start with HTTP 1.0 instead of the default HTTP 1.1?

The HTTP version number of the server is maintained as a part of the
connection data structure. libcurl keeps a number of connections open at once
in a connection pool, so a connection can be used by a number of different
requests over time. Once the server version is known, all requests on that
connection will conform to the version in use unless overridden by the
application.

> I cannot do a setopt to force HTTP 1.0 for every session handle since my
> program may use various proxies over time. What would be the best approach
> here?
>
> Appreciate any guidance here.

I'm not sure what exactly you're asking here. libcurl takes care of the HTTP
1.0 vs 1.1 distinction internally, so why does your application care about the
HTTP version in use on the server?

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-06