]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-socket: use port 80 when resolving name for local bind
authorDaniel Stenberg <daniel@haxx.se>
Fri, 17 Mar 2023 16:28:49 +0000 (17:28 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 17 Mar 2023 21:55:31 +0000 (22:55 +0100)
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

lib/cf-socket.c

index 86b024ac0d52d7f0797ea43daad52f5f8a2c9f66..6d9ace426121838264c803bdbd4ae85fd675cd5e 100644 (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;