quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_HTTP200ALIASES.md (2166B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_HTTP200ALIASES
      5 Section: 3
      6 Source: libcurl
      7 Protocol:
      8   - HTTP
      9 See-also:
     10   - CURLOPT_HTTP09_ALLOWED (3)
     11   - CURLOPT_HTTP_VERSION (3)
     12 Added-in: 7.10.3
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_HTTP200ALIASES - alternative matches for HTTP 200 OK
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP200ALIASES,
     25                           struct curl_slist *aliases);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a pointer to a linked list of *aliases* to be treated as valid HTTP 200
     31 responses. Some servers respond with a custom header response line. For
     32 example, SHOUTcast servers respond with "ICY 200 OK". Also some old Icecast
     33 1.3.x servers respond like that for certain user agent headers or in absence
     34 of such. By including this string in your list of aliases, the response gets
     35 treated as a valid HTTP header line such as "HTTP/1.0 200 OK".
     36 
     37 The linked list should be a fully valid list of struct curl_slist structs, and
     38 be properly filled in. Use curl_slist_append(3) to create the list and
     39 curl_slist_free_all(3) to clean up an entire list.
     40 
     41 The alias itself is not parsed for any version strings. The protocol is
     42 assumed to match HTTP 1.0 when an alias match.
     43 
     44 Using this option multiple times makes the last set list override the previous
     45 ones. Set it to NULL to disable its use again.
     46 
     47 libcurl does not copy the list, it needs to be kept around until after the
     48 transfer has completed.
     49 
     50 # DEFAULT
     51 
     52 NULL
     53 
     54 # %PROTOCOLS%
     55 
     56 # EXAMPLE
     57 
     58 ~~~c
     59 int 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 
     80 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     81 
     82 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     83 libcurl-errors(3).