summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-10-04 23:05:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-10-04 23:05:21 +0200
commitfcee05bfe3bc8d0d7d0040fd164446be3e27bae5 (patch)
tree2d023084cdce7cf49b804fb074c356a4573c0ce1
parentb8e4d1cb0ab3a35c768d85d099cdd0603325726f (diff)
downloadcurl-bagder/tool-ipresolve.tar.gz
curl: make sure setopt CURLOPT_IPRESOLVE passes on a longbagder/tool-ipresolve
Previously, it would pass on a define (int) which could make libcurl read junk as a vaulue - which prevented the CURLOPT_IPRESOLVE option to "take". This could then make test 2100 do two DoH requests instead of one! Fixes #6042
-rw-r--r--src/tool_getparam.c4
-rw-r--r--src/tool_operate.c7
2 files changed, 3 insertions, 8 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 7977c3dc6..910a5a2f9 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -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 */
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 54c99e3bc..e3fec0b4a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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)