| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, 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.haxx.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 |
|
| 30 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff); |
| 31 |
.fi |
| 32 |
.SH DESCRIPTION |
| 33 |
When \fICURLOPT_HTTPPROXYTUNNEL(3)\fP is used and a CONNECT request is made, |
| 34 |
suppress proxy CONNECT response headers from the user callback functions |
| 35 |
\fICURLOPT_HEADERFUNCTION(3)\fP and \fICURLOPT_WRITEFUNCTION(3)\fP. |
| 36 |
|
| 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 |
|
| 41 |
For example let's assume an HTTPS URL is to be retrieved via CONNECT. On |
| 42 |
success there would normally be two sets of headers, and each header line sent |
| 43 |
to the header function and/or the write function. The data given to the |
| 44 |
callbacks would look like this: |
| 45 |
|
| 46 |
.nf |
| 47 |
HTTP/1.1 200 Connection established |
| 48 |
{headers}... |
| 49 |
|
| 50 |
HTTP/1.1 200 OK |
| 51 |
Content-Type: application/json |
| 52 |
{headers}... |
| 53 |
|
| 54 |
{body}... |
| 55 |
.fi |
| 56 |
|
| 57 |
However by enabling this option the CONNECT response headers are suppressed, so |
| 58 |
the data given to the callbacks would look like this: |
| 59 |
|
| 60 |
.nf |
| 61 |
HTTP/1.1 200 OK |
| 62 |
Content-Type: application/json |
| 63 |
{headers}... |
| 64 |
|
| 65 |
{body}... |
| 66 |
.fi |
| 67 |
|
| 68 |
.SH DEFAULT |
| 69 |
0 |
| 70 |
.SH PROTOCOLS |
| 71 |
All |
| 72 |
.SH EXAMPLE |
| 73 |
.nf |
| 74 |
CURL *curl = curl_easy_init(); |
| 75 |
if(curl) { |
| 76 |
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); |
| 77 |
|
| 78 |
curl_easy_setopt(curl, CURLOPT_HEADER, 1L); |
| 79 |
curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128"); |
| 80 |
curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L); |
| 81 |
curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L); |
| 82 |
|
| 83 |
curl_easy_perform(curl); |
| 84 |
|
| 85 |
/* always cleanup */ |
| 86 |
curl_easy_cleanup(curl); |
| 87 |
} |
| 88 |
.fi |
| 89 |
.SH AVAILABILITY |
| 90 |
Added in 7.54.0 |
| 91 |
.SH RETURN VALUE |
| 92 |
CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. |
| 93 |
.SH "SEE ALSO" |
| 94 |
.BR CURLOPT_HEADER "(3), " CURLOPT_PROXY "(3), " |
| 95 |
.BR CURLOPT_HTTPPROXYTUNNEL "(3), " |