]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1
authorDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2025 07:50:20 +0000 (09:50 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2025 08:42:35 +0000 (10:42 +0200)
It is documented as valid. Regression from commit b059f7deaf3 shipped in
8.16.0

Reported-by: Andrei Kurushin
Fixes #18959
Closes #18960

lib/setopt.c

index 5558bded0a116e134013e68b970efae9ecd8b3ca..7097c7f7b0150acc561739627445ec0b636ad219 100644 (file)
@@ -879,7 +879,10 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
 
   switch(option) {
   case CURLOPT_DNS_CACHE_TIMEOUT:
-    return setopt_set_timeout_sec(&s->dns_cache_timeout_ms, arg);
+    if(arg != -1)
+      return setopt_set_timeout_sec(&s->dns_cache_timeout_ms, arg);
+    s->dns_cache_timeout_ms = -1;
+    break;
 
   case CURLOPT_CA_CACHE_TIMEOUT:
     if(Curl_ssl_supports(data, SSLSUPP_CA_CACHE)) {