CURLOPT_HAPROXY_CLIENT_IP.md (1543B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_HAPROXY_CLIENT_IP 5 Section: 3 6 Source: libcurl 7 Protocol: 8 - All 9 See-also: 10 - CURLOPT_HAPROXYPROTOCOL (3) 11 - CURLOPT_PROXY (3) 12 Added-in: 8.2.0 13 --- 14 15 # NAME 16 17 CURLOPT_HAPROXY_CLIENT_IP - set HAProxy PROXY protocol client IP 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP, 25 char *client_ip); 26 ~~~ 27 28 # DESCRIPTION 29 30 When this parameter is set to a valid IPv4 or IPv6 numerical address, the 31 library sends this address as client address in the HAProxy PROXY protocol v1 32 header at beginning of the connection. 33 34 This option is an alternative to CURLOPT_HAPROXYPROTOCOL(3) as that one cannot 35 use a specified address. 36 37 Using this option multiple times makes the last set string override the 38 previous ones. Set it to NULL to disable its use again. 39 40 The application does not have to keep the string around after setting this 41 option. 42 43 # DEFAULT 44 45 NULL, no HAProxy header is sent 46 47 # %PROTOCOLS% 48 49 # EXAMPLE 50 51 ~~~c 52 int main(void) 53 { 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode ret; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 58 curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1"); 59 ret = curl_easy_perform(curl); 60 } 61 } 62 ~~~ 63 64 # %AVAILABILITY% 65 66 # RETURN VALUE 67 68 curl_easy_setopt(3) returns a CURLcode indicating success or error. 69 70 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 71 libcurl-errors(3).