]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: disable CURLOPT_HAPROXY_CLIENT_IP on NULL
authorDaniel Stenberg <daniel@haxx.se>
Mon, 10 Nov 2025 00:02:37 +0000 (01:02 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 10 Nov 2025 06:49:00 +0000 (07:49 +0100)
As documented.

Reported-by: Stanislav Fort (Aisle Research)
Closes #19434

lib/setopt.c

index 90a1cf24a8d14f7a7b63204f076019fb675ee2e0..67b5371e87ddacd6dba33c467b8287f866467c6b 100644 (file)
@@ -2169,8 +2169,9 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
      * Set the client IP to send through HAProxy PROXY protocol
      */
     result = Curl_setstropt(&s->str[STRING_HAPROXY_CLIENT_IP], ptr);
-    /* enable the HAProxy protocol */
-    s->haproxyprotocol = TRUE;
+
+    /* enable the HAProxy protocol if an IP is provided */
+    s->haproxyprotocol = !!s->str[STRING_HAPROXY_CLIENT_IP];
     break;
 
 #endif