resolve: make forced IPv4 resolve only use A queries

This protects IPv4-only transfers from undesired bad IPv6-related side
effects and make IPv4 transfers in dual-stack libcurl behave the same
way as in IPv4 single-stack libcurl.

Closes #9540
This commit is contained in:
Dmitry Karpov 2022-09-19 13:59:35 -07:00 committed by Daniel Stenberg
parent ae9e713c4e
commit 1902e8fc51
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 29 additions and 5 deletions

View file

@ -707,7 +707,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
*waitp = 0; /* default to synchronous response */
#ifdef CURLRES_IPV6
if(Curl_ipv6works(data))
if(Curl_ipv6works(data) && data->conn->ip_version != CURL_IPRESOLVE_V4)
/* The stack seems to be IPv6-enabled */
pf = PF_UNSPEC;
#endif /* CURLRES_IPV6 */