CURLINFO_HTTP_CONNECTCODE.3 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .\" generated by cd2nroff 0.1 from CURLINFO_HTTP_CONNECTCODE.md
  2. .TH CURLINFO_HTTP_CONNECTCODE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_HTTP_CONNECTCODE \- get the CONNECT response code
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a long to receive the last received HTTP proxy response code
  12. to a CONNECT request. The returned value is zero if no such response code was
  13. available.
  14. .SH PROTOCOLS
  15. This functionality affects http only
  16. .SH EXAMPLE
  17. .nf
  18. int main(void)
  19. {
  20. CURL *curl = curl_easy_init();
  21. if(curl) {
  22. CURLcode res;
  23. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  24. /* typically CONNECT is used to do HTTPS over HTTP proxies */
  25. curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
  26. res = curl_easy_perform(curl);
  27. if(res == CURLE_OK) {
  28. long code;
  29. res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
  30. if(!res && code)
  31. printf("The CONNECT response code: %03ld\\n", code);
  32. }
  33. curl_easy_cleanup(curl);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.10.7
  39. .SH RETURN VALUE
  40. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  41. .SH SEE ALSO
  42. .BR CURLINFO_RESPONSE_CODE (3),
  43. .BR curl_easy_getinfo (3),
  44. .BR curl_easy_setopt (3)