1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_STREAM_DEPENDS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLMOPT_PIPELINING (3)
9  - CURLOPT_HTTP_VERSION (3)
10  - CURLOPT_STREAM_DEPENDS_E (3)
11  - CURLOPT_STREAM_WEIGHT (3)
12Protocol:
13  - HTTP
14Added-in: 7.46.0
15---
16
17# NAME
18
19CURLOPT_STREAM_DEPENDS - stream this transfer depends on
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS,
27                          CURL *dephandle);
28~~~
29
30# DESCRIPTION
31
32Pass a CURL pointer in *dephandle* to identify the stream within the same
33connection that this stream is depending upon. This option clears the
34exclusive bit and is mutually exclusive to the CURLOPT_STREAM_DEPENDS_E(3)
35option.
36
37The spec says "Including a dependency expresses a preference to allocate
38resources to the identified stream rather than to the dependent stream."
39
40This option can be set during transfer.
41
42*dephandle* must not be the same as *handle*, that makes this function return
43an error. It must be another easy handle, and it also needs to be a handle of
44a transfer that is about to be sent over the same HTTP/2 connection for this
45option to have an actual effect.
46
47# DEFAULT
48
49NULL
50
51# %PROTOCOLS%
52
53# EXAMPLE
54
55~~~c
56int main(void)
57{
58  CURL *curl = curl_easy_init();
59  CURL *curl2 = curl_easy_init(); /* a second handle */
60  if(curl) {
61    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
62
63    /* the second depends on the first */
64    curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
65    curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS, curl);
66
67    /* then add both to a multi handle and transfer them */
68  }
69}
70~~~
71
72# %AVAILABILITY%
73
74# RETURN VALUE
75
76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
77