1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_HTTP_CONNECTCODE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_RESPONSE_CODE (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11--- 12 13# NAME 14 15CURLINFO_HTTP_CONNECTCODE - get the CONNECT response code 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p); 23~~~ 24 25# DESCRIPTION 26 27Pass a pointer to a long to receive the last received HTTP proxy response code 28to a CONNECT request. The returned value is zero if no such response code was 29available. 30 31# PROTOCOLS 32 33HTTP 34 35# EXAMPLE 36 37~~~c 38int main(void) 39{ 40 CURL *curl = curl_easy_init(); 41 if(curl) { 42 CURLcode res; 43 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 44 45 /* typically CONNECT is used to do HTTPS over HTTP proxies */ 46 curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1"); 47 res = curl_easy_perform(curl); 48 if(res == CURLE_OK) { 49 long code; 50 res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code); 51 if(!res && code) 52 printf("The CONNECT response code: %03ld\n", code); 53 } 54 curl_easy_cleanup(curl); 55 } 56} 57~~~ 58 59# AVAILABILITY 60 61Added in 7.10.7 62 63# RETURN VALUE 64 65Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 66