From f0fed4e1310d689dcf9bebd84fc2b3632e01e544 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 8 Aug 2023 13:49:21 +0200 Subject: [PATCH] cf-haproxy: make CURLOPT_HAPROXY_CLIENT_IP set the *source* IP ... as documented. Update test 3201 and 3202 accordingly. Reported-by: Markus Sommer Fixes #11619 Closes #11626 --- lib/cf-haproxy.c | 4 ++-- tests/data/test3201 | 2 +- tests/data/test3202 | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cf-haproxy.c b/lib/cf-haproxy.c index 5c8e8e620c..39ac415717 100644 --- a/lib/cf-haproxy.c +++ b/lib/cf-haproxy.c @@ -86,12 +86,12 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter*cf, if(data->set.str[STRING_HAPROXY_CLIENT_IP]) client_ip = data->set.str[STRING_HAPROXY_CLIENT_IP]; else - client_ip = data->info.conn_primary_ip; + client_ip = data->info.conn_local_ip; result = Curl_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n", tcp_version, - data->info.conn_local_ip, client_ip, + data->info.conn_primary_ip, data->info.conn_local_port, data->info.conn_primary_port); diff --git a/tests/data/test3201 b/tests/data/test3201 index 4fb0b8fc64..730da8d932 100644 --- a/tests/data/test3201 +++ b/tests/data/test3201 @@ -48,7 +48,7 @@ proxy # Verify data after the test has been "shot" -s/^PROXY TCP4 %CLIENTIP 192.168.1.1 (\d*) %HTTPPORT/proxy-line/ +s/^PROXY TCP4 192.168.1.1 %HOSTIP (\d*) %HTTPPORT/proxy-line/ proxy-line diff --git a/tests/data/test3202 b/tests/data/test3202 index 8990abc83a..52d62b2b72 100644 --- a/tests/data/test3202 +++ b/tests/data/test3202 @@ -53,10 +53,10 @@ proxy # Strip off the (random) local port number. This test used to use a fixed # local port number that frequently causes the test to fail -s/PROXY TCP6 ::1 2001:db8:: (\d+) (\d+)/PROXY TCP6 ::1 2001:db8:: $2/ +s/^PROXY TCP6 2001:db8:: ::1 (\d*) %HTTP6PORT/proxy-line/ -PROXY TCP6 ::1 2001:db8:: %HTTP6PORT +proxy-line GET /%TESTNUMBER HTTP/1.1 Host: %HOST6IP:%HTTP6PORT User-Agent: curl/%VERSION