aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xauto/unix8
-rw-r--r--src/core/ngx_inet.c1
2 files changed, 7 insertions, 2 deletions
diff --git a/auto/unix b/auto/unix
index cd4209e7b..bc3c0f193 100755
--- a/auto/unix
+++ b/auto/unix
@@ -788,7 +788,11 @@ ngx_feature_incs="#include <sys/types.h>
#include <netdb.h>"
ngx_feature_path=
ngx_feature_libs=
-ngx_feature_test='struct addrinfo *res;
- if (getaddrinfo("localhost", NULL, NULL, &res) != 0) return 1;
+ngx_feature_test='struct addrinfo hints, *res;
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+ if (getaddrinfo("localhost", NULL, &hints, &res) != 0)
+ return 1;
freeaddrinfo(res)'
. auto/feature
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 5dca72bc2..2b5c94c00 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -963,6 +963,7 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
ngx_memzero(&hints, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
if (getaddrinfo((char *) host, NULL, &hints, &res) != 0) {
u->err = "host not found";