GNURLOPT_HTTP200ALIASES(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’– CURLOPT_HTTP200ALIASES πŸ’–

okay bestie, this is the GNURLOPT_HTTP200ALIASES(3) manual page, and we're learning how to tell libcurl/gnurl that some weird little response line is actually a valid HTTP 200 OK. no cap, it's a whole vibe. πŸ’…


🌈 NAME 🌈

CURLOPT_HTTP200ALIASES β€” specify alternative matches for HTTP 200 OK

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a pointer to a linked list of aliases, and each one gets treated like a valid HTTP 200 response. some servers are quirky and send a custom header response line. for example, SHOUTcast servers hit you with "ICY 200 OK". also some very old Icecast 1.3.x servers will respond like that for certain user agent headers or when there's no user agent header at all. by including this string in your list of aliases, the response is treated as a valid HTTP header line like "HTTP/1.0 200 OK". iconic, honestly. 🫢

The linked list should be a fully valid list of struct curl_slist structs, and it needs to be properly filled in. use curl_slist_append(3) to create the list and curl_slist_free_all(3) to clean up an entire list. don't skip the cleanup, bestie β€” that's main character energy. 🧹✨

The alias itself is not parsed for any version strings. when an alias matches, the protocol is assumed to match HTTP 1.0. periodt. πŸ’…

πŸŽ€ DEFAULT πŸŽ€

NULL

🌸 PROTOCOLS 🌸

HTTP

πŸ”₯ EXAMPLE πŸ”₯

CURL *curl = curl_easy_init();
if(curl) {
  struct curl_slist *list;
  curl_easy_setopt(curl, CURLOPT_URL, "http://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 */
}

⭐ AVAILABILITY ⭐

Added in 7.10.3. she's been around. πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.

🌈 SEE ALSO 🌈


okay bestie, that's the whole page. this icon was brought to you by libcurl 7.37.0, dated 17 Jun 2014, and yes the manual name is GNURLOPT_HTTP200ALIASES(3). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from