quickjs-tart

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

CURLOPT_PROXYHEADER.md (2035B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PROXYHEADER
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_HEADEROPT (3)
      9   - CURLOPT_HTTPHEADER (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.37.0
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_PROXYHEADER - set of HTTP headers to pass to proxy
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER,
     25                           struct curl_slist *headers);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a pointer to a linked list of HTTP headers to pass in your HTTP request
     31 sent to a proxy. The rules for this list is identical to the
     32 CURLOPT_HTTPHEADER(3) option's.
     33 
     34 The headers set with this option is only ever used in requests sent to a proxy
     35 - when there is also a request sent to a host.
     36 
     37 The first line in a request (containing the method, usually a GET or POST) is
     38 NOT a header and cannot be replaced using this option. Only the lines
     39 following the request-line are headers. Adding this method line in this list
     40 of headers causes your request to send an invalid header.
     41 
     42 Using this option multiple times makes the last set list override the previous
     43 ones. Set it to NULL to disable its use again.
     44 
     45 libcurl does not copy the list, it needs to be kept around until after the
     46 transfer has completed.
     47 
     48 # DEFAULT
     49 
     50 NULL
     51 
     52 # %PROTOCOLS%
     53 
     54 # EXAMPLE
     55 
     56 ~~~c
     57 int main(void)
     58 {
     59   CURL *curl = curl_easy_init();
     60 
     61   struct curl_slist *list;
     62 
     63   if(curl) {
     64     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     65     curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80");
     66 
     67     list = curl_slist_append(NULL, "Shoesize: 10");
     68     list = curl_slist_append(list, "Accept:");
     69 
     70     curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list);
     71 
     72     curl_easy_perform(curl);
     73 
     74     curl_slist_free_all(list); /* free the list again */
     75   }
     76 }
     77 ~~~
     78 
     79 # %AVAILABILITY%
     80 
     81 # RETURN VALUE
     82 
     83 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     84 
     85 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     86 libcurl-errors(3).