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