curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Multi and options

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 3 Feb 2020 14:50:21 +0100 (CET)

On Sat, 1 Feb 2020, Stephane Bortzmeyer via curl-library wrote:

> I have some interrogations about the options for the multi handles.
>
> Options like HTTP_VERSION or CONNECT_TO can only be set for ordinary
> handles, not for multi handles. This is documented and, indeed if I try to
> use them, libcurl complains.

Yes, options that are prefixed with CURLOPT_ are only "settable" with
curl_easy_setopt.

> But, when handles are used for HTTP/2 streams, it seems strange.
> HTTP_VERSION is "global", it is for the entire HTTP session, not for each
> stream.

I don't think that is totally true. You can make one transfer first with
HTTP/1.1 and then you can make a subsequent transfer (to the same or to
another host) with HTTP/2 (or even HTTP/3 if you're on the edge), serially or
in parallel.

I believe the connection reuse logic however, will prefer to reuse an existing
connection to creating a new, and that logic doesn't care about HTTP version -
maybe it should? So if you first setup a h2 request to host A, a subsequent
request to host A will probably go out as a h2 request even if you asked that
to use HTTP/1.1... Which is probably to be considered a bug I'd say...

> Why is it set in the ordinary handle and not in the multi handle? Is it
> because multi handles are also used to manage multiple HTTP connections?

I think HTTP version should be specified per transfer and not per collection
of transfers that happens to be done in the same multi handle.

I wouldn't totally object to a change that would enable seting a default HTTP
version in the multi handle that easy handles could "inherit" from in case
they don't have their own specific version set, but as we don't typically do
that for any other option I'm not sure starting such a trend is the best of
ideas.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-02-03