1CURLINFO_EFFECTIVE_METHOD(3)curl_easy_getinfo optionCsURLINFO_EFFECTIVE_METHOD(3)
2
3
4

NAME

6       CURLINFO_EFFECTIVE_METHOD - get the last used HTTP method
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_METHOD,
12                                  char **methodp);
13

DESCRIPTION

15       Pass  in  a  pointer  to a char pointer and get the last used effective
16       HTTP method.
17
18       In cases when you've asked libcurl to follow redirects, the method  may
19       very well not be the same method the first request would use.
20
21       The methodp pointer will be NULL or pointing to private memory you MUST
22       NOT free - it gets freed when you call curl_easy_cleanup(3) on the cor‐
23       responding CURL handle.
24

PROTOCOLS

26       HTTP(S)
27

EXAMPLE

29       CURL *curl = curl_easy_init();
30       if(curl) {
31         CURLcode res;
32         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
33         curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data");
34         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
35         res = curl_easy_perform(curl);
36         if(res == CURLE_OK) {
37           char *method = NULL;
38           curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
39           if(method)
40             printf("Redirected to method: %s\n", method);
41         }
42         curl_easy_cleanup(curl);
43       }
44

AVAILABILITY

46       Added in 7.72.0
47

RETURN VALUE

49       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
50       if not.
51

SEE ALSO

53       curl_easy_getinfo(3), curl_easy_setopt(3),
54
55
56
57libcurl 7.76.1                 November 04, 2020  CURLINFO_EFFECTIVE_METHOD(3)
Impressum