CURLOPT_STREAM_DEPENDS(3)

πŸ’… CURLOPT_STREAM_DEPENDS(3) β€” the "stream this transfer depends on" one

ok so this page lives in the Library Functions Manual section of the libcurl docs, and honestly bestie, it's a little bit of a sad story (deprecation arc 😭) but we're gonna get through it together.


🌸 NAME 🌸

CURLOPT_STREAM_DEPENDS β€” literally "stream this transfer depends on". that's the whole vibe. a stream that has a dependency.


✨ SYNOPSIS ✨

#include <curl/curl.h>

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

look at that signature. two handles. one of them is the dependee, one is the depender. bestie energy fr fr 🫢


πŸ’– DESCRIPTION πŸ’–

So here's the tea. You pass a CURL pointer in dephandle to identify the stream β€” within the same connection β€” that this stream is depending upon. it's giving "you're my emotional support stream" πŸ’…

Important bits, no cap:

  • This option clears the exclusive bit.
  • It is mutually exclusive to the CURLOPT_STREAM_DEPENDS_E(3) option. like, pick one. you can't have both. that's not the vibe.

The spec says β€” and I'm quoting here because it's iconic β€” "Including a dependency expresses a preference to allocate resources to the identified stream rather than to the dependent stream." so basically you're telling the server "hey, feed my friend first πŸ“".

You can set this option during transfer. it's flexible like that ✨

⚠️ okay so the rules, and these are real rules: dephandle must not be the same as handle β€” if it is, this function returns an error. periodt. It must be another easy handle, and it also needs to be a handle of a transfer that's about to be sent over the same HTTP/2 connection for this option to have an actual effect. otherwise it's just screaming into the void 😭

And now 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. they really said "we don't do that anymore". rip to a real one πŸ’€


πŸŽ€ DEFAULT πŸŽ€

NULL

like, nothing. nobody's depending on anybody. independent queen behavior πŸ‘‘


🌈 PROTOCOLS 🌈

This functionality affects http only. just http. that's it. that's the list.


πŸ¦‹ EXAMPLE πŸ¦‹

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, curl);

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

see how curl2 is like "I depend on curl"? cute. very sibling energy. the comment even says it: the second depends on the first 🫢 (and yes, you do have to add both to a multi handle and transfer them yourself β€” the comment says so, I don't make the rules)


πŸ’€ DEPRECATED πŸ’€

Deprecated since 8.21.0. she's retired but she's still iconic, okay? πŸ‘‘


⭐ AVAILABILITY ⭐

Added in curl 7.46.0. so she had a good run, ngl.


πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error.

  • CURLE_OK (0) means everything was OK πŸŽ‰
  • non-zero means an error occurred 😭 β€” see libcurl-errors(3) for the whole encyclopedia of what went wrong.

πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page bestie, you ate that πŸ’…βœ¨

🧚 signing off: this was libcurl, dated 2026-10-12, page CURLOPT_STREAM_DEPENDS(3). streams may come and go but the manual page remains πŸŽ€
πŸ“¦ where this page comes from