xref: /aosp_15_r20/external/curl/docs/libcurl/opts/CURLOPT_PIPEWAIT.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLOPT_PIPEWAIT
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - CURLMOPT_MAX_HOST_CONNECTIONS (3)
9*6236dae4SAndroid Build Coastguard Worker  - CURLMOPT_PIPELINING (3)
10*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_FORBID_REUSE (3)
11*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_FRESH_CONNECT (3)
12*6236dae4SAndroid Build Coastguard WorkerProtocol:
13*6236dae4SAndroid Build Coastguard Worker  - HTTP
14*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.43.0
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker# NAME
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard WorkerCURLOPT_PIPEWAIT - wait for multiplexing
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard Worker~~~c
24*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_PIPEWAIT, long wait);
27*6236dae4SAndroid Build Coastguard Worker~~~
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
30*6236dae4SAndroid Build Coastguard Worker
31*6236dae4SAndroid Build Coastguard WorkerSet *wait* to 1L to tell libcurl to prefer to wait for a connection to
32*6236dae4SAndroid Build Coastguard Workerconfirm or deny that it can do multiplexing before continuing.
33*6236dae4SAndroid Build Coastguard Worker
34*6236dae4SAndroid Build Coastguard WorkerWhen about to perform a new transfer that allows multiplexing, libcurl checks
35*6236dae4SAndroid Build Coastguard Workerfor existing connections to use. If no such connection exists it immediately
36*6236dae4SAndroid Build Coastguard Workercontinues and creates a fresh new connection to use.
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard WorkerBy setting this option to 1 - and having CURLMOPT_PIPELINING(3) enabled
39*6236dae4SAndroid Build Coastguard Workerfor the multi handle this transfer is associated with - libcurl instead waits
40*6236dae4SAndroid Build Coastguard Workerfor the connection to reveal if it is possible to multiplex on before it
41*6236dae4SAndroid Build Coastguard Workercontinues. This enables libcurl to much better keep the number of connections
42*6236dae4SAndroid Build Coastguard Workerto a minimum when using multiplexing protocols.
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard WorkerWith this option set, libcurl prefers to wait and reuse an existing connection
45*6236dae4SAndroid Build Coastguard Workerfor multiplexing rather than the opposite: prefer to open a new connection
46*6236dae4SAndroid Build Coastguard Workerrather than waiting.
47*6236dae4SAndroid Build Coastguard Worker
48*6236dae4SAndroid Build Coastguard WorkerThe waiting time is as long as it takes for the connection to get up and for
49*6236dae4SAndroid Build Coastguard Workerlibcurl to get the necessary response back that informs it about its protocol
50*6236dae4SAndroid Build Coastguard Workerand support level.
51*6236dae4SAndroid Build Coastguard Worker
52*6236dae4SAndroid Build Coastguard Worker# DEFAULT
53*6236dae4SAndroid Build Coastguard Worker
54*6236dae4SAndroid Build Coastguard Worker0 (off)
55*6236dae4SAndroid Build Coastguard Worker
56*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
57*6236dae4SAndroid Build Coastguard Worker
58*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
59*6236dae4SAndroid Build Coastguard Worker
60*6236dae4SAndroid Build Coastguard Worker~~~c
61*6236dae4SAndroid Build Coastguard Workerint main(void)
62*6236dae4SAndroid Build Coastguard Worker{
63*6236dae4SAndroid Build Coastguard Worker  CURL *curl = curl_easy_init();
64*6236dae4SAndroid Build Coastguard Worker  if(curl) {
65*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
66*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L);
67*6236dae4SAndroid Build Coastguard Worker
68*6236dae4SAndroid Build Coastguard Worker    /* now add this easy handle to the multi handle */
69*6236dae4SAndroid Build Coastguard Worker  }
70*6236dae4SAndroid Build Coastguard Worker}
71*6236dae4SAndroid Build Coastguard Worker~~~
72*6236dae4SAndroid Build Coastguard Worker
73*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
74*6236dae4SAndroid Build Coastguard Worker
75*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
76*6236dae4SAndroid Build Coastguard Worker
77*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
78