Buy commercial curl support. 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 Daniel himself.
Re: How can libcurl/curl_multi perform like curl --parallel ?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Oliver Schonrock via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 25 Oct 2024 19:45:09 +0100
On 25/10/2024 19:18, Dmitry Karpov via curl-library wrote:
> You don't really need to set CURLMOPT_MAX_TOTAL_CONNECTIONS = 1 to use HTTP2 multiplexing.
>
> You basically need to do the following steps:
> 1. Enable HTTP multiplexing by setting CURLMOPT_PIPELINING option on a multi-handle with CURLPIPE_MULTIPLEX flag.
> 2. Set CURLOPT_PIPEWAIT option to 1 on easy handle for each transfer you add to that multi-handle.
>
> The last setting will force the transfer to wait until the HTTP2 pipeline is ready and not try to open a new connection.
Ok, fair. What I was doing did feel like a cludge.
I was confused by the docs on CURLMOPT_MAX_PIPELINE_LENGTH which say
"removed in 7.62.0"
But yes.
curl_multi_setopt(curl_multi_handle, CURLMOPT_PIPELINING,
CURLPIPE_MULTIPLEX); // this is the default anyway
Plus
curl_easy_setopt(handle, CURLOPT_PIPEWAIT, 1L);
certainly works to enable / force the high performance HTTP2 mode, and
is much cleaner and clearer.
Thanks!
Oliver
Date: Fri, 25 Oct 2024 19:45:09 +0100
On 25/10/2024 19:18, Dmitry Karpov via curl-library wrote:
> You don't really need to set CURLMOPT_MAX_TOTAL_CONNECTIONS = 1 to use HTTP2 multiplexing.
>
> You basically need to do the following steps:
> 1. Enable HTTP multiplexing by setting CURLMOPT_PIPELINING option on a multi-handle with CURLPIPE_MULTIPLEX flag.
> 2. Set CURLOPT_PIPEWAIT option to 1 on easy handle for each transfer you add to that multi-handle.
>
> The last setting will force the transfer to wait until the HTTP2 pipeline is ready and not try to open a new connection.
Ok, fair. What I was doing did feel like a cludge.
I was confused by the docs on CURLMOPT_MAX_PIPELINE_LENGTH which say
"removed in 7.62.0"
But yes.
curl_multi_setopt(curl_multi_handle, CURLMOPT_PIPELINING,
CURLPIPE_MULTIPLEX); // this is the default anyway
Plus
curl_easy_setopt(handle, CURLOPT_PIPEWAIT, 1L);
certainly works to enable / force the high performance HTTP2 mode, and
is much cleaner and clearer.
Thanks!
Oliver
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2024-10-25