1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_HTTP200ALIASES 5Section: 3 6Source: libcurl 7Protocol: 8 - HTTP 9See-also: 10 - CURLOPT_HTTP09_ALLOWED (3) 11 - CURLOPT_HTTP_VERSION (3) 12Added-in: 7.10.3 13--- 14 15# NAME 16 17CURLOPT_HTTP200ALIASES - alternative matches for HTTP 200 OK 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP200ALIASES, 25 struct curl_slist *aliases); 26~~~ 27 28# DESCRIPTION 29 30Pass a pointer to a linked list of *aliases* to be treated as valid HTTP 200 31responses. Some servers respond with a custom header response line. For 32example, SHOUTcast servers respond with "ICY 200 OK". Also some old Icecast 331.3.x servers respond like that for certain user agent headers or in absence 34of such. By including this string in your list of aliases, the response gets 35treated as a valid HTTP header line such as "HTTP/1.0 200 OK". 36 37The linked list should be a fully valid list of struct curl_slist structs, and 38be properly filled in. Use curl_slist_append(3) to create the list and 39curl_slist_free_all(3) to clean up an entire list. 40 41The alias itself is not parsed for any version strings. The protocol is 42assumed to match HTTP 1.0 when an alias match. 43 44Using this option multiple times makes the last set list override the previous 45ones. Set it to NULL to disable its use again. 46 47libcurl does not copy the list, it needs to be kept around until after the 48transfer has completed. 49 50# DEFAULT 51 52NULL 53 54# %PROTOCOLS% 55 56# EXAMPLE 57 58~~~c 59int main(void) 60{ 61 CURL *curl = curl_easy_init(); 62 if(curl) { 63 struct curl_slist *list; 64 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 65 66 list = curl_slist_append(NULL, "ICY 200 OK"); 67 list = curl_slist_append(list, "WEIRDO 99 FINE"); 68 69 curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list); 70 curl_easy_perform(curl); 71 curl_slist_free_all(list); /* free the list again */ 72 } 73} 74~~~ 75 76# %AVAILABILITY% 77 78# RETURN VALUE 79 80Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. 81