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