1CURLINFO_HTTP_CONNECTCODE(3)        libcurl       CURLINFO_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, long *p);
12

DESCRIPTION

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

PROTOCOLS

19       HTTP
20

EXAMPLE

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

AVAILABILITY

40       Added in 7.10.7
41

RETURN VALUE

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

SEE ALSO

47       CURLINFO_RESPONSE_CODE(3), curl_easy_getinfo(3), curl_easy_setopt(3),
48
49
50
51ibcurl 8.2.1                    April 26, 2023    CURLINFO_HTTP_CONNECTCODE(3)
Impressum