CURLOPT_HAPROXYPROTOCOL.md (1322B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_HAPROXYPROTOCOL 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PROXY (3) 9 Protocol: 10 - All 11 Added-in: 7.60.0 12 --- 13 14 # NAME 15 16 CURLOPT_HAPROXYPROTOCOL - send HAProxy PROXY protocol v1 header 17 18 # SYNOPSIS 19 20 ~~~c 21 #include <curl/curl.h> 22 23 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL, 24 long haproxy_protocol); 25 ~~~ 26 27 # DESCRIPTION 28 29 A long parameter set to 1 tells the library to send an HAProxy PROXY 30 protocol v1 header at beginning of the connection. The default action is not to 31 send this header. 32 33 This option is primarily useful when sending test requests to a service that 34 expects this header. 35 36 Most applications do not need this option. 37 38 # DEFAULT 39 40 0, do not send any HAProxy PROXY protocol header 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int 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 63 curl_easy_setopt(3) returns a CURLcode indicating success or error. 64 65 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 66 libcurl-errors(3).