GNURLMOPT_PIPELINING(3)
π
GNURLMOPT_PIPELINING(3) β aka the curl_multi_setopt options girlies' page π
okay so bestie, welcome to the multi-handle corner of the manual, the one filed under curl_multi_setopt options β¨ grab a boba, this one's about making your connections do double duty.
πΈ NAME πΈ
CURLMOPT_PIPELINING β enable HTTP pipelining and multiplexing, no cap π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, long
bitmask);
π¦ DESCRIPTION π¦
okay so you pass in that bitmask parameter and it literally tells libcurl to enable HTTP pipelining and/or HTTP/2 multiplexing for this multi handle. that's the whole vibe. π
When it's enabled, libcurl will attempt to use those protocol features when it's doing parallel requests to the same hosts. sharing is caring fr fr.
For pipelining, this means that if you add a second request that can use an already existing connection, the second request will be "piped" on the same connection rather than being executed in parallel. iconic behavior honestly.
For multiplexing, this means that follow-up requests can re-use an existing connection and send the new request multiplexed over that at the same time as other transfers are already using that single connection. one connection, many transfers, main character energy π«Ά
There are several other related options that are interesting to tweak and adjust to alter how libcurl spreads out requests on different connections or not etc. (iykyk, go read those pages.)
The lore π: Before 7.43.0, this option was set to 1 and 0 to enable and disable HTTP/1.1 pipelining. Starting in 7.43.0, bitmask's second bit also has a meaning, and you can ask for pipelining and multiplexing independently of each other by toggling the correct bits. glow-up of the century honestly.
π CURLPIPE_NOTHING
Default, which means doing no attempts at pipelining or multiplexing. the chill, do-nothing option.
π CURLPIPE_HTTP1
If this bit is set, libcurl will try to pipeline HTTP/1.1 requests on connections that are already established and in use to hosts.
β οΈ heads up bestie: this bit is deprecated and has no effect since version 7.62.0. it's giving retired icon π
π CURLPIPE_MULTIPLEX
If this bit is set, libcurl will try to multiplex the new transfer over an existing connection if possible. This requires HTTP/2. that's the good stuff β¨
π§ DEFAULT π§
Since 7.62.0, CURLPIPE_MULTIPLEX is enabled by default. π
Before that, default was CURLPIPE_NOTHING. simpler times.
π PROTOCOLS π
HTTP(S) β that's it, that's the list π
π₯ EXAMPLE π₯
CURLM *m = curl_multi_init();
/* try HTTP/2 multiplexing */
curl_multi_setopt(m, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
literally three lines and you're multiplexing. ate and left no crumbs π°
β AVAILABILITY β
Added in 7.16.0. Multiplex support bit added in 7.43.0. HTTP/1 Pipelining support was disabled in 7.62.0. history lesson over, go forth π¦
π RETURN VALUE π
Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. two outcomes, no in-between, periodt.
π SEE ALSO π
CURLMOPT_MAX_PIPELINE_LENGTH(3)CURLMOPT_PIPELINING_SITE_BL(3)CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)CURLMOPT_MAX_HOST_CONNECTIONS(3)CURLMOPT_MAXCONNECTS(3)CURLMOPT_MAX_HOST_CONNECTIONS(3)
(yes CURLMOPT_MAX_HOST_CONNECTIONS(3) is in there twice, the original said it twice, we keep it twice, consistency queen π
)
π«Ά and that's the page! brought to you by libcurl7.37.0, dated17 Jun 2014, filed underGNURLMOPT_PIPELINING(3). mwah, go pipeline responsibly ππ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms