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