]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-haproxy: make CURLOPT_HAPROXY_CLIENT_IP set the *source* IP
authorDaniel Stenberg <daniel@haxx.se>
Tue, 8 Aug 2023 11:49:21 +0000 (13:49 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 8 Aug 2023 15:05:24 +0000 (17:05 +0200)
... as documented.

Update test 3201 and 3202 accordingly.

Reported-by: Markus Sommer
Fixes #11619
Closes #11626

lib/cf-haproxy.c
tests/data/test3201
tests/data/test3202

index 5c8e8e620ce5e1c6915ec6121b5a979755f6e0ba..39ac4157175c30eb4d0fcb3950b428b55bd3e881 100644 (file)
@@ -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);
 
index 4fb0b8fc6413ded0a2ace3488665d8b467f8f0ab..730da8d9327573fe9d3fcf5fa12275471e198c56 100644 (file)
@@ -48,7 +48,7 @@ proxy
 # Verify data after the test has been "shot"
 <verify>
 <strippart>
-s/^PROXY TCP4 %CLIENTIP 192.168.1.1 (\d*) %HTTPPORT/proxy-line/
+s/^PROXY TCP4 192.168.1.1 %HOSTIP (\d*) %HTTPPORT/proxy-line/
 </strippart>
 <protocol>
 proxy-line\r
index 8990abc83aaabb0ca3b8597e959a723cb050bf65..52d62b2b72ca0739ca057809e95e369ad35b830f 100644 (file)
@@ -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
 <strippart>
-s/PROXY TCP6 ::1 2001:db8:: (\d+) (\d+)/PROXY TCP6 ::1 2001:db8:: $2/
+s/^PROXY TCP6 2001:db8:: ::1 (\d*) %HTTP6PORT/proxy-line/
 </strippart>
 <protocol>
-PROXY TCP6 ::1 2001:db8:: %HTTP6PORT\r
+proxy-line\r
 GET /%TESTNUMBER HTTP/1.1\r
 Host: %HOST6IP:%HTTP6PORT\r
 User-Agent: curl/%VERSION\r