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