CURLOPT_SUPPRESS_CONNECT_HEADERS.3 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_SUPPRESS_CONNECT_HEADERS 3 "13 February 2017" "libcurl 7.54.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_SUPPRESS_CONNECT_HEADERS \- suppress proxy CONNECT response headers from user callbacks
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff);
  30. .fi
  31. .SH DESCRIPTION
  32. When \fICURLOPT_HTTPPROXYTUNNEL(3)\fP is used and a CONNECT request is made,
  33. suppress proxy CONNECT response headers from the user callback functions
  34. \fICURLOPT_HEADERFUNCTION(3)\fP and \fICURLOPT_WRITEFUNCTION(3)\fP.
  35. Proxy CONNECT response headers can complicate header processing since it's
  36. essentially a separate set of headers. You can enable this option to suppress
  37. those headers.
  38. For example let's assume an HTTPS URL is to be retrieved via CONNECT. On
  39. success there would normally be two sets of headers, and each header line sent
  40. to the header function and/or the write function. The data given to the
  41. callbacks would look like this:
  42. .nf
  43. HTTP/1.1 200 Connection established
  44. {headers}...
  45. HTTP/1.1 200 OK
  46. Content-Type: application/json
  47. {headers}...
  48. {body}...
  49. .fi
  50. However by enabling this option the CONNECT response headers are suppressed, so
  51. the data given to the callbacks would look like this:
  52. .nf
  53. HTTP/1.1 200 OK
  54. Content-Type: application/json
  55. {headers}...
  56. {body}...
  57. .fi
  58. .SH DEFAULT
  59. 0
  60. .SH PROTOCOLS
  61. All
  62. .SH EXAMPLE
  63. .nf
  64. CURL *curl = curl_easy_init();
  65. if(curl) {
  66. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  67. curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
  68. curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
  69. curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
  70. curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
  71. curl_easy_perform(curl);
  72. /* always cleanup */
  73. curl_easy_cleanup(curl);
  74. }
  75. .fi
  76. .SH AVAILABILITY
  77. Added in 7.54.0
  78. .SH RETURN VALUE
  79. CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
  80. .SH "SEE ALSO"
  81. .BR CURLOPT_HEADER "(3), " CURLOPT_PROXY "(3), "
  82. .BR CURLOPT_HTTPPROXYTUNNEL "(3), "