1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_PIPEWAIT 5Section: 3 6Source: libcurl 7See-also: 8 - CURLMOPT_MAX_HOST_CONNECTIONS (3) 9 - CURLMOPT_PIPELINING (3) 10 - CURLOPT_FORBID_REUSE (3) 11 - CURLOPT_FRESH_CONNECT (3) 12Protocol: 13 - HTTP 14--- 15 16# NAME 17 18CURLOPT_PIPEWAIT - wait for multiplexing 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PIPEWAIT, long wait); 26~~~ 27 28# DESCRIPTION 29 30Set *wait* to 1L to tell libcurl to prefer to wait for a connection to 31confirm or deny that it can do multiplexing before continuing. 32 33When about to perform a new transfer that allows multiplexing, libcurl checks 34for existing connections to use. If no such connection exists it immediately 35continues and creates a fresh new connection to use. 36 37By setting this option to 1 - and having CURLMOPT_PIPELINING(3) enabled 38for the multi handle this transfer is associated with - libcurl instead waits 39for the connection to reveal if it is possible to multiplex on before it 40continues. This enables libcurl to much better keep the number of connections 41to a minimum when using multiplexing protocols. 42 43With this option set, libcurl prefers to wait and reuse an existing connection 44for multiplexing rather than the opposite: prefer to open a new connection 45rather than waiting. 46 47The waiting time is as long as it takes for the connection to get up and for 48libcurl to get the necessary response back that informs it about its protocol 49and support level. 50 51# DEFAULT 52 530 (off) 54 55# EXAMPLE 56 57~~~c 58int main(void) 59{ 60 CURL *curl = curl_easy_init(); 61 if(curl) { 62 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 63 curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L); 64 65 /* now add this easy handle to the multi handle */ 66 } 67} 68~~~ 69 70# AVAILABILITY 71 72Added in 7.43.0 73 74# RETURN VALUE 75 76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 77