cf-socket: use port 80 when resolving name for local bind

It turns out c-ares returns an error when asked to resolve a host name with
ares_getaddrinfo using port number 0.

Reported as a c-ares bug here: https://github.com/c-ares/c-ares/issues/517

The work-around is to simply use port 80 instead, as the number typically does
not make a difference and a non-zero number works for c-ares.

Fixes #10759
Reported-by: Matt Jolly
Closes #10789
This commit is contained in:
Daniel Stenberg 2023-03-17 17:28:49 +01:00
parent c3f3c2557c
commit 138860576f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -495,7 +495,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
conn->ip_version = CURL_IPRESOLVE_V6;
#endif
rc = Curl_resolv(data, dev, 0, FALSE, &h);
rc = Curl_resolv(data, dev, 80, FALSE, &h);
if(rc == CURLRESOLV_PENDING)
(void)Curl_resolver_wait_resolv(data, &h);
conn->ip_version = ipver;