]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
asyn-ares: set hint flags when calling ares_getaddrinfo
authorbsergean <bsergean@gmail.com>
Mon, 10 Oct 2022 23:24:43 +0000 (16:24 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Oct 2022 06:23:33 +0000 (08:23 +0200)
The hint flag is ARES_AI_NUMERICSERV, and it will save a call to
getservbyname or getservbyname_r to set it.

Closes #9694

.mailmap
lib/asyn-ares.c

index 639806ca67ba80dac6fa06007a6396c8b3b06ec2..5092131dd9535b70da8bf5766ac1dc0dfcf8e543 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -97,4 +97,5 @@ opensignature on github <antonio@piumarossa.it>
 Cering on github <gfypm@qq.com>
 a1346054 on github <36859588+a1346054@users.noreply.github.com>
 zhanghu on xiaomi <zhanghu6@xiaomi.com>
-Philip Heiduck <pheiduck@Philips-MBP.lan> <47042125+pheiduck@users.noreply.github.com>
\ No newline at end of file
+Philip Heiduck <pheiduck@Philips-MBP.lan> <47042125+pheiduck@users.noreply.github.com>
+bsergean on github <bsergean@gmail.com>
index cbc0e2ea77c9057831cce964fd24acabe94d15ef..33edba1395983bf30ebe1528ca9f7e6c5c8d6a72 100644 (file)
@@ -786,6 +786,10 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
       hints.ai_family = pf;
       hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP)?
         SOCK_STREAM : SOCK_DGRAM;
+      /* Since the service is a numerical one, set the hint flags
+       * accordingly to save a call to getservbyname in inside C-Ares
+       */
+      hints.ai_flags = ARES_AI_NUMERICSERV;
       msnprintf(service, sizeof(service), "%d", port);
       res->num_pending = 1;
       ares_getaddrinfo((ares_channel)data->state.async.resolver, hostname,