CURLINFO_HTTP_CONNECTCODE(3)
π CURLINFO_H...CONNECTCODE(3)
okay bestie, so you found the manual page for CURLINFO_H...CONNECTCODE(3) β that's the library functions manual, and yes the title got truncated by the terminal because it's long, it's giving "cut off mid-sentence" energy but it's iconic like that. Let's go π
β¨ NAME β¨
CURLINFO_HTTP_CONNECTCODE β the CONNECT response code, periodt π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p);
πΈ DESCRIPTION πΈ
so basically: you pass in a pointer to a long, right? and it gets filled with the last received HTTP proxy response code to a CONNECT request. that's it, that's the whole vibe.
and if there was no such response code available? the returned value is literally 0. zero. nothing. zilch. ngl it's the "no thoughts head empty" of response codes π
π§ PROTOCOLS π§
lowkey this functionality affects http only. that's the whole list bestie, one item, slay β
π₯ EXAMPLE π₯
here's the whole thing, copy it verbatim because it ate and left no crumbs:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
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");
result = curl_easy_perform(curl);
if(result == CURLE_OK) {
long code;
result = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
if(!result && code)
printf("The CONNECT response code: %03ld\n", code);
}
curl_easy_cleanup(curl);
}
}
like look at that comment β typically CONNECT is used to do HTTPS over HTTP proxies π iconic behavior honestly.
π AVAILABILITY π
added in curl 7.10.7 π«Ά (yes, she's been around a while, she's a veteran, main character energy from day one)
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode indicating success or error β that's the whole rule.
CURLE_OK (0) means everything was OK π and non-zero means an error occurred, so go check libcurl-errors(3) for the deets. no cap, that's where the answers live.
π SEE ALSO π
π«Ά friendly reminder bestie: 0 from this call doesn't mean "error", it means "no response code was available". don't come for her, she's just being honest π
okay that's the page!! this was brought to you by libcurl, dated 2026-10-12 β same CURLINFO_H...CONNECTCODE(3) queen, signing off π
β¨π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms