]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: make --doh-url "" switch it off
authorDaniel Stenberg <daniel@haxx.se>
Tue, 26 Jul 2022 09:00:31 +0000 (11:00 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 Jul 2022 08:56:13 +0000 (10:56 +0200)
A possible future addition could be to parse the URL first too to verify
that it is valid before trying to use it.

Assisted-by: Jay Satiro
Closes #9207

docs/cmdline-opts/doh-url.d
src/tool_getparam.c

index 94e1a0b956e8cf8cd13b7cf6d20e6e2f86ca0de0..746623ff45a44e8c0913f3038e2fc8ef613d747f 100644 (file)
@@ -16,4 +16,7 @@ name lookups take place over SSL. However, the certificate verification
 settings are not inherited and can be controlled separately via
 --doh-insecure and --doh-cert-status.
 
+This option is unset if an empty string "" is used as the URL. (Added in
+7.85.0)
+
 If this option is used several times, the last one will be used.
index 9bbd51d34e77c44b67ccfb3401577a3e4179e2d8..f2ad91c193195434a4749ba17c97125f872721d5 100644 (file)
@@ -701,6 +701,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         break;
       case 'C': /* doh-url */
         GetStr(&config->doh_url, nextarg);
+        if(config->doh_url && !config->doh_url[0])
+          /* if given a blank string, we make it NULL again */
+          Curl_safefree(config->doh_url);
         break;
       case 'd': /* ciphers */
         GetStr(&config->cipher_list, nextarg);