quickjs-tart

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

CURLINFO_REFERER.md (1451B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLINFO_REFERER
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_REFERER (3)
      9   - curl_easy_getinfo (3)
     10   - curl_easy_header (3)
     11   - curl_easy_setopt (3)
     12 Protocol:
     13   - HTTP
     14 Added-in: 7.76.0
     15 ---
     16 
     17 # NAME
     18 
     19 CURLINFO_REFERER - get the used referrer request header
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REFERER, char **hdrp);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Pass in a pointer to a char pointer and get the referrer header used in the
     32 most recent request.
     33 
     34 The **hdrp** pointer is NULL or points to private memory you MUST NOT free -
     35 it gets freed when you call curl_easy_cleanup(3) on the corresponding curl
     36 handle.
     37 
     38 # %PROTOCOLS%
     39 
     40 # EXAMPLE
     41 
     42 ~~~c
     43 int main(void)
     44 {
     45   CURL *curl = curl_easy_init();
     46   if(curl) {
     47     CURLcode res;
     48     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     49     curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/referrer");
     50     res = curl_easy_perform(curl);
     51     if(res == CURLE_OK) {
     52       char *hdr = NULL;
     53       curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
     54       if(hdr)
     55         printf("Referrer header: %s\n", hdr);
     56     }
     57     curl_easy_cleanup(curl);
     58   }
     59 }
     60 ~~~
     61 
     62 # %AVAILABILITY%
     63 
     64 # RETURN VALUE
     65 
     66 curl_easy_getinfo(3) returns a CURLcode indicating success or error.
     67 
     68 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     69 libcurl-errors(3).