Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_SUPPRESS_CONNECT_HEADERS.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2017, 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.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 "April 28, 2016" "libcurl 7.59.0" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_SUPPRESS_CONNECT_HEADERS \- Suppress proxy CONNECT response headers from user callbacks
27 .SH SYNOPSIS
28 .nf
29 #include <curl/curl.h>
30
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
38 Proxy CONNECT response headers can complicate header processing since it's
39 essentially a separate set of headers. You can enable this option to suppress
40 those headers.
41
42 For example let's assume an HTTPS URL is to be retrieved via CONNECT. On
43 success there would normally be two sets of headers, and each header line sent
44 to the header function and/or the write function. The data given to the
45 callbacks would look like this:
46
47 .nf
48 HTTP/1.1 200 Connection established
49 {headers}...
50
51 HTTP/1.1 200 OK
52 Content-Type: application/json
53 {headers}...
54
55 {body}...
56 .fi
57
58 However by enabling this option the CONNECT response headers are suppressed, so
59 the data given to the callbacks would look like this:
60
61 .nf
62 HTTP/1.1 200 OK
63 Content-Type: application/json
64 {headers}...
65
66 {body}...
67 .fi
68
69 .SH DEFAULT
70 0
71 .SH PROTOCOLS
72 All
73 .SH EXAMPLE
74 .nf
75 CURL *curl = curl_easy_init();
76 if(curl) {
77   curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
78
79   curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
80   curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
81   curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
82   curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
83
84   curl_easy_perform(curl);
85
86   /* always cleanup */
87   curl_easy_cleanup(curl);
88 }
89 .fi
90 .SH AVAILABILITY
91 Added in 7.54.0
92 .SH RETURN VALUE
93 CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
94 .SH "SEE ALSO"
95 .BR CURLOPT_HEADER "(3), " CURLOPT_PROXY "(3), "
96 .BR CURLOPT_HTTPPROXYTUNNEL "(3), "