You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use this command "curl -v -m4 https://www.google.com" to test how curl responds in various changes in responses to dns queries made by curl. To do this i am using a very simple dns server which responds to queries which are only "www.google.com" .
The first case is i try to execute the above command what i notice is in this case is that both ipv4 and ipv6 queries are sent from the c-ares library. But if ipv6 is not received before the timeout occurs the command fails even though the ipv4 response is obtained .
STATE: INIT => CONNECT handle 0x565138d20998; line 1789 (connection #-5000)
Added connection 0. The cache now contains 1 members
15:29:31.722618 IP 6a5a2727f400.38880 > 10.174.75.167.domain: 60498+ A? www.google.com. (32)
15:29:31.722853 IP 6a5a2727f400.38880 > 10.174.75.167.domain: 50175+ AAAA? www.google.com. (32)
STATE: CONNECT => RESOLVING handle 0x565138d20998; line 1835 (connection #0)
15:29:31.723211 IP 10.174.75.167.domain > 6a5a2727f400.38880: 60498* 1/0/0 A 142.250.195.228 (49)
15:29:31.723230 IP 10.174.75.167.domain > 6a5a2727f400.38880: 60498* 1/0/0 A 142.250.195.228 (49)
Resolving timed out after 4001 milliseconds
multi_done
The cache now contains 0 members
Closing connection 0
Expire cleared (transfer 0x565138d20998)
curl: (28) Resolving timed out after 4001 milliseconds
in this cases also both queries are sent out. Now if i do it just for ipv6 also the similar issue occurs both queries are sent out.
If i changed the curl version to 7.87.0 then the "-4" option works here it only sends the query for ipv4 and doesn't initiate for ipv6 . But even in that version if i execute "-6" option then both ipv4 and ipv6 dns queries are sent out.
Could you help me with this?
I expected the following
curl should return after the timeout and use what ever ip is obtained from the dns query response. To initiate the connection.
curl should return after the timeout and use what ever ip is obtained from the dns query response. To initiate the connection.
That's not how name resolving typically works. When we use c-ares, we ask c-ares to resolve the host name and if it returns error that is a failure for us. c-ares should however not consider a partial response as an error, but that's not curl's domain.
even in that version if i execute "-6" option then both ipv4 and ipv6 dns queries are sent out.
While I don't think the man page guarantees this, it looks like an oversight in the code.
Previously it would always do PF_UNSPEC if CURL_IPRESOLVE_V4 is not
used, thus unnecessarily asking for addresses that will not be used.
Reported-by: Joseph Tharayil
Fixes#11564
Previously it would always do PF_UNSPEC if CURL_IPRESOLVE_V4 is not
used, thus unnecessarily asking for addresses that will not be used.
Reported-by: Joseph Tharayil
Fixescurl#11564Closescurl#11565
I did this
Hi Team,
I am using curl 7.79.1 with c-ares 1.17.2.
I use this command "curl -v -m4 https://www.google.com" to test how curl responds in various changes in responses to dns queries made by curl. To do this i am using a very simple dns server which responds to queries which are only "www.google.com" .
The first case is i try to execute the above command what i notice is in this case is that both ipv4 and ipv6 queries are sent from the c-ares library. But if ipv6 is not received before the timeout occurs the command fails even though the ipv4 response is obtained .
curl -v -m4 https://www.google.com
STATE: INIT => CONNECT handle 0x563c74ff8998; line 1789 (connection #-5000)
Added connection 0. The cache now contains 1 members
15:29:38.735975 IP 6a5a2727f400.34325 > 10.174.75.167.domain: 63432+ A? www.google.com. (32)
15:29:38.736177 IP 6a5a2727f400.34325 > 10.174.75.167.domain: 56463+ AAAA? www.google.com. (32)
STATE: CONNECT => RESOLVING handle 0x563c74ff8998; line 1835 (connection #0)
15:29:38.736618 IP 10.174.75.167.domain > 6a5a2727f400.34325: 63432 1/0/0 A 142.250.195.228 (49)*
15:29:38.736834 IP 10.174.75.167.domain > 6a5a2727f400.34325: 63432* 1/0/0 A 142.250.195.228 (49)
Resolving timed out after 4001 milliseconds
multi_done
The cache now contains 0 members
Closing connection 0
Expire cleared (transfer 0x563c74ff8998)
curl: (28) Resolving timed out after 4001 milliseconds
Ok now what i do is i only try to send the ipv4 request using the -4 option but this also doesn't work with this curl version of 7.79.1.
curl -v -m4 -4 https://www.google.com
15:29:31.722618 IP 6a5a2727f400.38880 > 10.174.75.167.domain: 60498+ A? www.google.com. (32)
15:29:31.722853 IP 6a5a2727f400.38880 > 10.174.75.167.domain: 50175+ AAAA? www.google.com. (32)
15:29:31.723211 IP 10.174.75.167.domain > 6a5a2727f400.38880: 60498* 1/0/0 A 142.250.195.228 (49)
15:29:31.723230 IP 10.174.75.167.domain > 6a5a2727f400.38880: 60498* 1/0/0 A 142.250.195.228 (49)
curl: (28) Resolving timed out after 4001 milliseconds
in this cases also both queries are sent out. Now if i do it just for ipv6 also the similar issue occurs both queries are sent out.
If i changed the curl version to 7.87.0 then the "-4" option works here it only sends the query for ipv4 and doesn't initiate for ipv6 . But even in that version if i execute "-6" option then both ipv4 and ipv6 dns queries are sent out.
Could you help me with this?
I expected the following
curl should return after the timeout and use what ever ip is obtained from the dns query response. To initiate the connection.
curl/libcurl version
root@6a5a2727f400:/# curl -V curl 7.79.1 (x86_64-pc-linux-gnu) libcurl/7.79.1 OpenSSL/1.1.1f c-ares/1.17.2 Release-Date: 2021-09-22 Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS Debug HSTS HTTPS-proxy IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP TrackMemory UnixSockets
operating system
uname -a Linux 6a5a2727f400 5.4.0-136-generic #153~18.04.1-Ubuntu SMP Wed Nov 30 15:47:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: