]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: make sure setopt CURLOPT_IPRESOLVE passes on a long
authorDaniel Stenberg <daniel@haxx.se>
Sun, 4 Oct 2020 21:05:21 +0000 (23:05 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 5 Oct 2020 08:06:58 +0000 (10:06 +0200)
Previously, it would pass on a define (int) which could make libcurl
read junk as a value - which prevented the CURLOPT_IPRESOLVE option to
"take". This could then make test 2100 do two DoH requests instead of
one!

Fixes #6042
Closes #6043

src/tool_getparam.c
src/tool_operate.c

index 7977c3dc614a625e4b47b9303ef4c6bfc2877300..910a5a2f9a6350a206b361b82fd49690060e2d04 100644 (file)
@@ -1269,11 +1269,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       break;
     case '4':
       /* IPv4 */
-      config->ip_version = 4;
+      config->ip_version = CURL_IPRESOLVE_V4;
       break;
     case '6':
       /* IPv6 */
-      config->ip_version = 6;
+      config->ip_version = CURL_IPRESOLVE_V6;
       break;
     case 'a':
       /* This makes the FTP sessions use APPE instead of STOR */
index 54c99e3bcfeab852433fa7184b042bf637786422..e3fec0b4a003703efe5d41ad4b3bb278bdb62225 100644 (file)
@@ -1855,12 +1855,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
           my_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,
                     config->max_filesize);
 
-        if(4 == config->ip_version)
-          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
-        else if(6 == config->ip_version)
-          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
-        else
-          my_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
+        my_setopt(curl, CURLOPT_IPRESOLVE, config->ip_version);
 
         /* new in curl 7.15.5 */
         if(config->ftp_ssl_reqd)