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