GNURLINFO_...ONNECTCODE(3)
π GNURLINFO_...ONNECTCODE(3) π
okay so bestie, welcome to the curl_easy_getinfo options corner of the manual π this one is all about grabbing the response code from an HTTP proxy's CONNECT reply, and yes it is as niche as it sounds but also lowkey iconic β¨
πΈ NAME πΈ
CURLINFO_HTTP_CONNECTCODE β get the CONNECT response code π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long
*p);
π¦ DESCRIPTION π¦
bestie, you pass a pointer to a long and it receives the last received HTTP proxy response code to a CONNECT request. that's the whole vibe π
and if no such response code was available? the returned value will be zero. no cap, that's just how it is π«Ά
π PROTOCOLS π
HTTP
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* typically CONNECT is used to do HTTPS over HTTP proxies */
curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long code;
res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
if(!res && code)
printf("The CONNECT response code: %03ld\n", code);
}
curl_easy_cleanup(curl);
}
β AVAILABILITY β
Added in 7.10.7 β¨
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. periodt π
π₯ SEE ALSO π₯
bestie if you're messing with proxy CONNECT codes, this is your lil' main character function. go off ππ
this iconic lil' page is brought to you by libcurl 7.44.0, dated 28 Aug 2015 πβ¨π¦
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms