CURLOPT_HTTP200ALIASES(3)

πŸ’… CURLOPT_HTTP200ALIASES(3) β€” the curl library functions manual, bestie edition πŸŽ€

ok so this page lives in the libcurl manual (section 3, the library-functions girlies ✨) and it's literally all about CURLOPT_HTTP200ALIASES. Let's get into it πŸ¦‹


✨ NAME ✨

CURLOPT_HTTP200ALIASES β€” alternative matches for HTTP 200 OK πŸ‘‘


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP200ALIASES,
                          struct curl_slist *aliases);

πŸ’– DESCRIPTION πŸ’–

okay so picture this: you pass in a pointer to a linked list of aliases β€” like, strings that libcurl should treat as totally valid HTTP 200 responses. no cap. why? because some servers are extra and respond with a custom header response line instead of the standard one 🫠

the iconic example: SHOUTcast servers respond with "ICY 200 OK". also some old Icecast 1.3.x servers pull that same move for certain user agent headers, or when there's no such header at all. rude but okay πŸ’€

by including that string in your list of aliases, the response gets treated like a valid HTTP header line β€” like "HTTP/1.0 200 OK". slay ✨

the linked list should be a fully valid list of struct curl_slist structs, and properly filled in, bestie. use curl_slist_append(3) to build the list and curl_slist_free_all(3) to clean up an entire list when you're done 🧹

⚠️ heads up: the alias itself is not parsed for any version strings. the protocol is assumed to match HTTP 1.0 when an alias match happens. so don't go expecting version detection magic, iykyk.

using this option multiple times makes the last set list override the previous ones (last one wins, main character energy πŸ‘‘). set it to NULL to disable its use again.

πŸ”₯ and this is the important one: libcurl does not copy the list. it needs to be kept around until after the transfer has completed. fr fr, don't free it early or it's giving undefined chaos 😭

πŸŽ€ DEFAULT πŸŽ€

NULL


🌈 PROTOCOLS 🌈

this functionality affects http only 🌐


⭐ EXAMPLE ⭐

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    struct curl_slist *list;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");

    list = curl_slist_append(NULL, "ICY 200 OK");
    list = curl_slist_append(list, "WEIRDO 99 FINE");

    curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list);
    curl_easy_perform(curl);
    curl_slist_free_all(list); /* free the list again */
  }
}

look at that list getting built and then freed again at the end β€” responsible queen behavior πŸ’…


πŸ¦‹ AVAILABILITY πŸ¦‹

added in curl 7.10.3 β€” vintage but still iconic ✨


πŸ’œ 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 full tea.


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page babes 🫢 β€” brought to you by libcurl, dated 2026-10-12, page CURLOPT_HTTP200ALIASES(3), signing off πŸ’–βœ¨

πŸ“¦ where this page comes from