1CURLINFO_HTTP_CONNECTCODE(3)curl_easy_getinfo optionCsURLINFO_HTTP_CONNECTCODE(3)
2
3
4

NAME

6       CURLINFO_HTTP_CONNECTCODE - get the CONNECT response code
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode   curl_easy_getinfo(CURL  *handle,  CURLINFO_HTTP_CONNECTCODE,
12       long *p);
13

DESCRIPTION

15       Pass a pointer to a long  to  receive  the  last  received  HTTP  proxy
16       response  code to a CONNECT request. The returned value will be zero if
17       no such response code was available.
18

PROTOCOLS

20       HTTP
21

EXAMPLE

23       CURL *curl = curl_easy_init();
24       if(curl) {
25         CURLcode res;
26         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
27
28         /* typically CONNECT is used to do HTTPS over HTTP proxies */
29         curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
30         res = curl_easy_perform(curl);
31         if(res == CURLE_OK) {
32           long code;
33           res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
34           if(!res && code)
35             printf("The CONNECT response code: %03ld\n", code);
36         }
37         curl_easy_cleanup(curl);
38       }
39

AVAILABILITY

41       Added in 7.10.7
42

RETURN VALUE

44       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
45       if not.
46

SEE ALSO

48       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
49
50
51
52libcurl 7.66.0                   May 06, 2017     CURLINFO_HTTP_CONNECTCODE(3)
Impressum