diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2019-07-21 16:27:55 +0300 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2019-07-21 16:27:55 +0300 |
commit | 962373e5c61fbed30f4288fb34f9f0ab1415055e (patch) | |
tree | 644481c67df567a3a1138deded75fa553ce9d8b1 | |
parent | de4460fbd17e303996c79fc68879dc1918b695f1 (diff) |
getaddrinfo: fix behaviour when node is null and !passive
according to the spec, if these 2 conditions hold, the name shall
resolve to localhost.
closes #292
-rw-r--r-- | src/core.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -879,6 +879,10 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin goto err2; } else if(node) { af = ((struct sockaddr_in *) &space->sockaddr_space)->sin_family; + } else if(!node && !(hints->ai_flags & AI_PASSIVE)) { + af = ((struct sockaddr_in *) &space->sockaddr_space)->sin_family = AF_INET; + memcpy(&((struct sockaddr_in *) &space->sockaddr_space)->sin_addr, + (char[]){127,0,0,1}, 4); } if(service) mygetservbyname_r(service, NULL, &se_buf, buf, sizeof(buf), &se); |