Skip to content

curl v7.66 onwards does not apply --resolve for the --doh-url #6589

Description

@mbhatia

I have been trying to test a DNS-over-HTTPS implementation and ran into issues with the curl command line not applying the --resolve option for the --doh-url itself.

Seems like this broke in curl v7.66. It's difficult to show a fully working example because of TLS, but see below for the DNS resolution of --doh-url.

Expected Output (curl v7.65)

doh.example.com successfully resolved to 1.1.1.1

$ docker run -it curlimages/curl:7.65.3 --verbose --resolve 'doh.example.com:443:1.1.1.1' --doh-url "https://doh.example.com:443/dns-query" google.com
* Added doh.example.com:443:1.1.1.1 to DNS cache
* Hostname doh.example.com was found in DNS cache
*   Trying 1.1.1.1:443...
* TCP_NODELAY set
* Found bundle for host doh.example.com: 0x559c0ec1c380 [serially]
* Server doesn't support multiplex (yet)
* Connection #1 is still name resolving, can't reuse
* Hostname doh.example.com was found in DNS cache
*   Trying 1.1.1.1:443...
* TCP_NODELAY set
* Connected to doh.example.com (1.1.1.1) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
...

Incorrect Output (curl v7.66)

doh.example.com is not resolved.

$ docker run -it curlimages/curl:7.66.0 --verbose --resolve 'doh.example.com:443:1.1.1.1' --doh-url "https://doh.example.com:443/dns-query" google.com
* Added doh.example.com:443:1.1.1.1 to DNS cache
* Found bundle for host doh.example.com: 0x5634d7899640 [serially]
* Server doesn't support multiplex (yet)
* Connection #0 is still name resolving, can't reuse
* Could not resolve host: doh.example.com
* Closing connection 0
* a DOH request is completed, 1 to go
* DOH request Couldn't resolve host name
* Could not resolve host: doh.example.com
* Closing connection 1
* a DOH request is completed, 0 to go
* DOH request Couldn't resolve host name
* DOH: Too small type A for google.com
* DOH: Too small type AAAA for google.com
* Closing connection 0
curl: (6) Couldn't resolve host name

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions