1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HAPROXYPROTOCOL
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROXY (3)
9---
10
11# NAME
12
13CURLOPT_HAPROXYPROTOCOL - send HAProxy PROXY protocol v1 header
14
15# SYNOPSIS
16
17~~~c
18#include <curl/curl.h>
19
20CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL,
21                          long haproxy_protocol);
22~~~
23
24# DESCRIPTION
25
26A long parameter set to 1 tells the library to send an HAProxy PROXY
27protocol v1 header at beginning of the connection. The default action is not to
28send this header.
29
30This option is primarily useful when sending test requests to a service that
31expects this header.
32
33Most applications do not need this option.
34
35# DEFAULT
36
370, do not send any HAProxy PROXY protocol header
38
39# PROTOCOLS
40
41HTTP
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    CURLcode ret;
51    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
52    curl_easy_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L);
53    ret = curl_easy_perform(curl);
54  }
55}
56~~~
57
58# AVAILABILITY
59
60Along with HTTP. Added in 7.60.0.
61
62# RETURN VALUE
63
64Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
65