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