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