]> granicus.if.org Git - curl/commitdiff
curl: --doh-url added
authorDaniel Stenberg <daniel@haxx.se>
Thu, 6 Sep 2018 07:16:02 +0000 (09:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 6 Sep 2018 07:17:25 +0000 (09:17 +0200)
docs/cmdline-opts/Makefile.inc
docs/cmdline-opts/doh-url.d [new file with mode: 0644]
src/tool_cfgable.c
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c

index fe5fb5baf819c98cc537363eeef7a0ec0d3fe994..76fa5d45fdceb27edb3b735c1a095b58907054d3 100644 (file)
@@ -2,7 +2,7 @@
 
 DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d cacert.d capath.d cert.d \
   cert-status.d cert-type.d ciphers.d compressed.d compressed-ssh.d     \
-  config.d                                                              \
+  config.d doh-url.d                                                    \
   connect-timeout.d connect-to.d continue-at.d cookie.d cookie-jar.d    \
   create-dirs.d crlf.d crlfile.d data-ascii.d data-binary.d data.d      \
   data-raw.d data-urlencode.d delegation.d digest.d disable.d           \
diff --git a/docs/cmdline-opts/doh-url.d b/docs/cmdline-opts/doh-url.d
new file mode 100644 (file)
index 0000000..8fa42c1
--- /dev/null
@@ -0,0 +1,9 @@
+Long: doh-url
+Arg: <URL>
+Help: Resolve host names over DOH
+Protocols: all
+---
+Specifies which DNS-over-HTTPS (DOH) server to use to resolve hostnames,
+instead of using the default name resolver mechanism. The URL must be HTTPS.
+
+If this option is used several times, the last one will be used.
index 81e16c1c8179909b69bd59cfa5699f6fd2ca4d5d..7d088ae0fb042724f45b585bcd1129da7d5faa59 100644 (file)
@@ -102,6 +102,7 @@ static void free_config_fields(struct OperationConfig *config)
   config->url_get = NULL;
   config->url_out = NULL;
 
+  Curl_safefree(config->doh_url);
   Curl_safefree(config->cipher_list);
   Curl_safefree(config->proxy_cipher_list);
   Curl_safefree(config->cert);
index a0363e9a7db7ae96cf4d8915f69ea8f8a0be746c..b719fa21916e14dcc53c92b49bcbb930aff70053 100644 (file)
@@ -115,6 +115,7 @@ struct OperationConfig {
   struct getout *url_get;   /* point to the node to fill in URL */
   struct getout *url_out;   /* point to the node to fill in outfile */
   struct getout *url_ul;    /* point to the node to fill in upload */
+  char *doh_url;
   char *cipher_list;
   char *proxy_cipher_list;
   char *cipher13_list;
index aad147148c66fb5f0a222d1501c068c95c71b382..58f3f582772ebbd793f948ec66cf5e52532dfdc9 100644 (file)
@@ -80,6 +80,7 @@ static const struct LongShort aliases[]= {
   {"*b", "egd-file",                 ARG_STRING},
   {"*B", "oauth2-bearer",            ARG_STRING},
   {"*c", "connect-timeout",          ARG_STRING},
+  {"*C", "doh-url"        ,          ARG_STRING},
   {"*d", "ciphers",                  ARG_STRING},
   {"*D", "dns-interface",            ARG_STRING},
   {"*e", "disable-epsv",             ARG_BOOL},
@@ -619,6 +620,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         if(err)
           return err;
         break;
+      case 'C': /* doh-url */
+        GetStr(&config->doh_url, nextarg);
+        break;
       case 'd': /* ciphers */
         GetStr(&config->cipher_list, nextarg);
         break;
index b829e76ef00889bf00fdccda2540abc8d5351c10..5b04ea203b0e8bbc5f1e807a885f8c2cbbc73f73 100644 (file)
@@ -118,6 +118,8 @@ static const struct helptxt helptext[] = {
    "IPv6 address to use for DNS requests"},
   {"    --dns-servers <addresses>",
    "DNS server addrs to use"},
+  {"    --doh-url <URL>",
+   "Resolve host names over DOH"},
   {"-D, --dump-header <filename>",
    "Write the received headers to <filename>"},
   {"    --egd-file <file>",
index 2c3f6dd4cedbe3be37b6ef033ce20d715a2aa64b..5a72b6a8c3e3a5357b9688bc4d094e2a5b61e7d9 100644 (file)
@@ -1262,6 +1262,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
         my_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS,
                   (long)(config->connecttimeout * 1000));
 
+        if(config->doh_url)
+          my_setopt_str(curl, CURLOPT_DOH_URL, config->doh_url);
+
         if(config->cipher_list)
           my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list);