quickjs-tart

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

CURLOPT_AUTOREFERER.md (1733B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_AUTOREFERER
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_EFFECTIVE_URL (3)
      9   - CURLINFO_REDIRECT_URL (3)
     10   - CURLINFO_REFERER (3)
     11   - CURLOPT_FOLLOWLOCATION (3)
     12   - CURLOPT_REFERER (3)
     13 Protocol:
     14   - HTTP
     15 Added-in: 7.1
     16 ---
     17 
     18 # NAME
     19 
     20 CURLOPT_AUTOREFERER - automatically update the referer header
     21 
     22 # SYNOPSIS
     23 
     24 ~~~c
     25 #include <curl/curl.h>
     26 
     27 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long autorefer);
     28 ~~~
     29 
     30 # DESCRIPTION
     31 
     32 Pass a long parameter set to 1 to enable this. When enabled, libcurl
     33 automatically sets the Referer: header field in HTTP requests to the full URL
     34 when it follows a Location: redirect to a new destination.
     35 
     36 The automatic referer is set to the full previous URL even when redirects are
     37 done cross-origin or following redirects to insecure protocols. This is
     38 considered a minor privacy leak by some.
     39 
     40 With CURLINFO_REFERER(3), applications can extract the actually used
     41 referer header after the transfer.
     42 
     43 # DEFAULT
     44 
     45 0, disabled
     46 
     47 # %PROTOCOLS%
     48 
     49 # EXAMPLE
     50 
     51 ~~~c
     52 int main(void)
     53 {
     54   CURL *curl = curl_easy_init();
     55   if(curl) {
     56     CURLcode res;
     57     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
     58 
     59     /* follow redirects */
     60     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
     61 
     62     /* set Referer: automatically when following redirects */
     63     curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
     64 
     65     res = curl_easy_perform(curl);
     66 
     67     curl_easy_cleanup(curl);
     68   }
     69 }
     70 ~~~
     71 
     72 # %AVAILABILITY%
     73 
     74 # RETURN VALUE
     75 
     76 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     77 
     78 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     79 libcurl-errors(3).