CURLOPT_SUPPRESS_CONNECT_HEADERS.3 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_SUPPRESS_CONNECT_HEADERS 3 "13 February 2017" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_SUPPRESS_CONNECT_HEADERS \- suppress proxy CONNECT response headers from user callbacks
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff);
  32. .fi
  33. .SH DESCRIPTION
  34. When \fICURLOPT_HTTPPROXYTUNNEL(3)\fP is used and a CONNECT request is made,
  35. suppress proxy CONNECT response headers from the user callback functions
  36. \fICURLOPT_HEADERFUNCTION(3)\fP and \fICURLOPT_WRITEFUNCTION(3)\fP.
  37. Proxy CONNECT response headers can complicate header processing since it's
  38. essentially a separate set of headers. You can enable this option to suppress
  39. those headers.
  40. For example let's assume an HTTPS URL is to be retrieved via CONNECT. On
  41. success there would normally be two sets of headers, and each header line sent
  42. to the header function and/or the write function. The data given to the
  43. callbacks would look like this:
  44. .nf
  45. HTTP/1.1 200 Connection established
  46. {headers}...
  47. HTTP/1.1 200 OK
  48. Content-Type: application/json
  49. {headers}...
  50. {body}...
  51. .fi
  52. However by enabling this option the CONNECT response headers are suppressed, so
  53. the data given to the callbacks would look like this:
  54. .nf
  55. HTTP/1.1 200 OK
  56. Content-Type: application/json
  57. {headers}...
  58. {body}...
  59. .fi
  60. .SH DEFAULT
  61. 0
  62. .SH PROTOCOLS
  63. All
  64. .SH EXAMPLE
  65. .nf
  66. CURL *curl = curl_easy_init();
  67. if(curl) {
  68. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  69. curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
  70. curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
  71. curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
  72. curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
  73. curl_easy_perform(curl);
  74. /* always cleanup */
  75. curl_easy_cleanup(curl);
  76. }
  77. .fi
  78. .SH AVAILABILITY
  79. Added in 7.54.0
  80. .SH RETURN VALUE
  81. CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
  82. .SH "SEE ALSO"
  83. .BR CURLOPT_HEADER "(3), " CURLOPT_PROXY "(3), "
  84. .BR CURLOPT_HTTPPROXYTUNNEL "(3), "