quickjs-tart

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

CURLINFO_EFFECTIVE_URL.md (1508B)


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