CURLOPT_STREAM_DEPENDS_E(3)

πŸ’… CURLOPT_STREAM_DEPENDS_E(3) β€” like, the exclusive-stream-dependency one, bestie

okay so this is a page from the Library Functions Manual and honestly? it's giving "iconic feature that got canceled" 😭 but we're gonna learn it anyway because knowledge is free ✨ the function is CURLOPT_STREAM_DEPENDS_E and its whole personality is "stream this transfer depends on exclusively" β€” and yes, the _E stands for Exclusive, we love a dramatic capital letter πŸ’…


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS_E,
                          CURL *dephandle);

🌸 DESCRIPTION 🌸

so basically you pass a CURL pointer in dephandle and that's you telling curl "hey bestie, this stream depends on that stream β€” exclusively β€” within the same connection." 🫢 that means it depends on it and it sets the Exclusive bit. both things. at once. main character energy fr fr πŸ‘‘

the spec is out here saying, and I quote directly:

"Including a dependency expresses a preference to allocate resources to the identified stream rather than to the dependent stream."

like yes, the spec said preference, we love a polite king 🌈

and okay, here's the tea on what exclusive actually does: setting a dependency with the exclusive flag for a reprioritized stream causes all the dependencies of the new parent stream to become dependent on the reprioritized stream. so like... the whole family tree gets rearranged. it's giving reprioritization arc πŸ’€

this option can be set during transfer β€” no need to finish anything first, go off ✨

now the rules, because there are always rules πŸ™ˆ:

  • dephandle must not be the same as handle. if you do that? the function returns an error. not it.
  • it must be another easy handle
  • and it also needs to be a handle of a transfer that is about to be sent over the same HTTP/2 connection β€” otherwise this option doesn't actually do anything, it's just vibes πŸ’…
⚠️ and now for the sad part 😭 β€” since version 8.21.0, setting this option no longer has an effect. HTTP/2 stream dependencies were introduced in RFC 7540 and then later deprecated in RFC 9113. it was iconic, then it was deprecated. we've all been there πŸŽ€

πŸŽ€ DEFAULT πŸŽ€

NULL

(obviously. no dependency, no drama. a clean slate. a fresh face. πŸ¦‹)


πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects http only β€” that's it, that's the tweet πŸ’œ


πŸ”₯ EXAMPLE πŸ”₯

here's the actual example, character for character, because we do not mess with code in this house:

int main(void)
{
  CURL *curl = curl_easy_init();
  CURL *curl2 = curl_easy_init(); /* a second handle */
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");

    /* the second depends on the first */
    curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
    curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS_E, curl);

    /* then add both to a multi handle and transfer them */
  }
}

see how curl2 is like "I'm nothing without curl" 😭 obsessed. the comment literally says /* the second depends on the first */ β€” the way that comment ate πŸ’€


πŸ’€ DEPRECATED πŸ’€

Deprecated since 8.21.0. yeah. we know. it's fine. it's fine. πŸ₯²


⭐ AVAILABILITY ⭐

Added in curl 7.46.0 β€” a vintage. an icon. a legend, even 🌟


🌈 RETURN VALUE 🌈

curl_easy_setopt(3) returns a CURLcode indicating success or error πŸ’–

CURLE_OK (0) means everything was OK β€” slay πŸŽ‰ non-zero means an error occurred, so go check libcurl-errors(3) for the whole lore dump πŸ“–


πŸ‘‘ SEE ALSO πŸ‘‘

(yes go read those too, we're nothing if not thorough 🫢)


and that's the whole page, bestie πŸ’– brought to you by libcurl, dated 2026-10-12, with love from the Library Functions Manual β€” stay exclusive, stay deprecated, stay iconic ✨ πŸŽ€ πŸ¦‹ πŸ’…

πŸ“¦ where this page comes from