1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HAPROXY_CLIENT_IP
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_HAPROXYPROTOCOL (3)
9  - CURLOPT_PROXY (3)
10---
11
12# NAME
13
14CURLOPT_HAPROXY_CLIENT_IP - set HAProxy PROXY protocol client IP
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP,
22                          char *client_ip);
23~~~
24
25# DESCRIPTION
26
27When this parameter is set to a valid IPv4 or IPv6 numerical address, the
28library sends this address as client address in the HAProxy PROXY protocol v1
29header at beginning of the connection.
30
31This option is an alternative to CURLOPT_HAPROXYPROTOCOL(3) as that one
32cannot use a specified address.
33
34# DEFAULT
35
36NULL, no HAProxy header is sent
37
38# PROTOCOLS
39
40HTTP, HAProxy PROTOCOL
41
42# EXAMPLE
43
44~~~c
45int main(void)
46{
47  CURL *curl = curl_easy_init();
48  if(curl) {
49    CURLcode ret;
50    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
51    curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
52    ret = curl_easy_perform(curl);
53  }
54}
55~~~
56
57# AVAILABILITY
58
59Along with HTTP. Added in 8.2.0.
60
61# RETURN VALUE
62
63Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
64