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