CURLOPT_RTSP_TRANSPORT(3)

πŸ’… CURLOPT_RTSP_TRANSPORT(3) β€” the RTSP Transport: header glow-up

okay so bestie, welcome to the CURLOPT_RTSP_TRANSPORT(3) page from the Library Functions Manual β€” yes we're in libcurl land and this one is lowkey iconic if you're doing RTSP stuff πŸŽ€


✨ SYNOPSIS ✨

like, here's the whole vibe in code:

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_TRANSPORT,
                          char *transport);

🌸 DESCRIPTION 🌸

so you pass a char pointer and it literally tells libcurl what to send as the Transport: header for this RTSP session πŸ¦‹

it's mainly a convenience method β€” the whole point is to avoid needing to set a custom Transport: header for every single SETUP request. imagine doing that manually every time, no thank you πŸ’€

⚠️ important bestie: the application must set a Transport: header before issuing a SETUP request. that's not optional, periodt.

and the slay part? the application does not have to keep the string around after setting this option. set it and forget it, main character energy πŸ‘‘


🧚 DEFAULT 🧚

NULL


🌈 PROTOCOLS 🌈

this functionality affects rtsp only. rtsp girlies only, iykyk πŸ’…


⭐ EXAMPLE ⭐

here's how it's giving in practice:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
    curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
    curl_easy_setopt(curl, CURLOPT_RTSP_TRANSPORT,
                     "RTP/AVP;unicast;client_port=4588-4589");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

πŸ’œ HISTORY πŸ’œ

fun little lore drop: CURL_RTSPREQ_* enums became long types in 8.13.0. before that version, a long cast was necessary when passed to curl_easy_setopt(3). the more you know 🌟


🫢 AVAILABILITY 🫢

added in curl 7.20.0 β€” vintage but cute ✨


πŸ”₯ 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 β€” go check libcurl-errors(3) bestie 😭

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, no cap πŸ’– this libcurl page is dated 2026-10-12 and comes to you from the libcurl fam β€” talk soon bestie, mwah πŸ“πŸ’…

πŸ“¦ where this page comes from