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