CURLOPT_SUPPRESS_CONNECT_HEADERS.3 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SUPPRESS_CONNECT_HEADERS.md
  2. .TH CURLOPT_SUPPRESS_CONNECT_HEADERS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SUPPRESS_CONNECT_HEADERS \- suppress proxy CONNECT response headers
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff);
  9. .fi
  10. .SH DESCRIPTION
  11. When \fICURLOPT_HTTPPROXYTUNNEL(3)\fP is used and a CONNECT request is made,
  12. suppress proxy CONNECT response headers from the user callback functions
  13. \fICURLOPT_HEADERFUNCTION(3)\fP and \fICURLOPT_WRITEFUNCTION(3)\fP.
  14. Proxy CONNECT response headers can complicate header processing since it is
  15. essentially a separate set of headers. You can enable this option to suppress
  16. those headers.
  17. For example let\(aqs assume an HTTPS URL is to be retrieved via CONNECT. On
  18. success there would normally be two sets of headers, and each header line sent
  19. to the header function and/or the write function. The data given to the
  20. callbacks would look like this:
  21. .nf
  22. HTTP/1.1 200 Connection established
  23. {headers}
  24. \&...
  25. HTTP/1.1 200 OK
  26. Content-Type: application/json
  27. {headers}
  28. \&...
  29. {body}
  30. \&...
  31. .fi
  32. However by enabling this option the CONNECT response headers are suppressed,
  33. so the data given to the callbacks would look like this:
  34. .nf
  35. HTTP/1.1 200 OK
  36. Content-Type: application/json
  37. {headers}
  38. \&...
  39. {body}
  40. \&...
  41. .fi
  42. .SH DEFAULT
  43. 0
  44. .SH PROTOCOLS
  45. This functionality affects all supported protocols
  46. .SH EXAMPLE
  47. .nf
  48. int main(void)
  49. {
  50. CURL *curl = curl_easy_init();
  51. if(curl) {
  52. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  53. curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
  54. curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
  55. curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
  56. curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
  57. curl_easy_perform(curl);
  58. /* always cleanup */
  59. curl_easy_cleanup(curl);
  60. }
  61. }
  62. .fi
  63. .SH AVAILABILITY
  64. Added in curl 7.54.0
  65. .SH RETURN VALUE
  66. CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
  67. .SH SEE ALSO
  68. .BR CURLOPT_HEADER (3),
  69. .BR CURLOPT_HTTPPROXYTUNNEL (3),
  70. .BR CURLOPT_PROXY (3)