1CURLOPT_SUPPRESS_CONNECT_HEADERS(3) libcurlCURLOPT_SUPPRESS_CONNECT_HEADERS(3)
2
3
4

NAME

6       CURLOPT_SUPPRESS_CONNECT_HEADERS  -  suppress  proxy  CONNECT  response
7       headers from user callbacks
8

SYNOPSIS

10       #include <curl/curl.h>
11
12       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff);
13

DESCRIPTION

15       When CURLOPT_HTTPPROXYTUNNEL(3) is used and a CONNECT request is  made,
16       suppress  proxy  CONNECT  response headers from the user callback func‐
17       tions CURLOPT_HEADERFUNCTION(3) and CURLOPT_WRITEFUNCTION(3).
18
19       Proxy CONNECT response headers can complicate header  processing  since
20       it's  essentially a separate set of headers. You can enable this option
21       to suppress those headers.
22
23       For example let's assume an HTTPS URL is to be retrieved  via  CONNECT.
24       On success there would normally be two sets of headers, and each header
25       line sent to the header function and/or the write  function.  The  data
26       given to the callbacks would look like this:
27
28       HTTP/1.1 200 Connection established
29       {headers}...
30
31       HTTP/1.1 200 OK
32       Content-Type: application/json
33       {headers}...
34
35       {body}...
36
37       However  by  enabling this option the CONNECT response headers are sup‐
38       pressed, so the data given to the callbacks would look like this:
39
40       HTTP/1.1 200 OK
41       Content-Type: application/json
42       {headers}...
43
44       {body}...
45
46

DEFAULT

48       0
49

PROTOCOLS

51       All
52

EXAMPLE

54       CURL *curl = curl_easy_init();
55       if(curl) {
56         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
57
58         curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
59         curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
60         curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
61         curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
62
63         curl_easy_perform(curl);
64
65         /* always cleanup */
66         curl_easy_cleanup(curl);
67       }
68

AVAILABILITY

70       Added in 7.54.0
71

RETURN VALUE

73       CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
74

SEE ALSO

76       CURLOPT_HEADER(3), CURLOPT_PROXY(3), CURLOPT_HTTPPROXYTUNNEL(3),
77
78
79
80ibcurl 8.2.1                    April 26, 20C2U3RLOPT_SUPPRESS_CONNECT_HEADERS(3)
Impressum