mirror of
https://github.com/curl/curl.git
synced 2026-07-24 15:47:16 +03:00
CURLOPT_HAPROXYPROTOCOL: support the HAProxy PROXY protocol
Add --haproxy-protocol for the command line tool Closes #2162
This commit is contained in:
parent
9572831b04
commit
6baeb6df35
16 changed files with 261 additions and 1 deletions
|
|
@ -252,6 +252,7 @@ struct OperationConfig {
|
|||
bool ssh_compression; /* enable/disable SSH compression */
|
||||
long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
|
||||
0 is valid. default: CURL_HET_DEFAULT. */
|
||||
bool haproxy_protocol; /* whether to send HAProxy PROXY protocol */
|
||||
struct GlobalConfig *global;
|
||||
struct OperationConfig *prev;
|
||||
struct OperationConfig *next; /* Always last in the struct */
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ static const struct LongShort aliases[]= {
|
|||
{"*x", "krb", ARG_STRING},
|
||||
{"*x", "krb4", ARG_STRING},
|
||||
/* 'krb4' is the previous name */
|
||||
{"*X", "haproxy-protocol", ARG_BOOL},
|
||||
{"*y", "max-filesize", ARG_STRING},
|
||||
{"*z", "disable-eprt", ARG_BOOL},
|
||||
{"*Z", "eprt", ARG_BOOL},
|
||||
|
|
@ -779,6 +780,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||
else
|
||||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
break;
|
||||
case 'X': /* --haproxy-protocol */
|
||||
config->haproxy_protocol = toggle;
|
||||
break;
|
||||
case 'y': /* --max-filesize */
|
||||
{
|
||||
curl_off_t value;
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ static const struct helptxt helptext[] = {
|
|||
"How long to wait in milliseconds for IPv6 before trying IPv4"},
|
||||
{"-I, --head",
|
||||
"Show document info only"},
|
||||
{" --haproxy-protocol",
|
||||
"Send HAProxy PROXY protocol header"},
|
||||
{"-H, --header <header/@file>",
|
||||
"Pass custom header(s) to server"},
|
||||
{"-h, --help",
|
||||
|
|
|
|||
|
|
@ -1445,6 +1445,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||
my_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
|
||||
config->happy_eyeballs_timeout_ms);
|
||||
|
||||
/* new in 7.60.0 */
|
||||
if(config->haproxy_protocol)
|
||||
my_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L);
|
||||
|
||||
/* initialize retry vars for loop below */
|
||||
retry_sleep_default = (config->retry_delay) ?
|
||||
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue