mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 10:20:29 +00:00
Fix Fetch usage on urls without host before server gets an address
This commit is contained in:
parent
7756427077
commit
d7b7fb9dc8
1 changed files with 3 additions and 2 deletions
|
@ -3805,10 +3805,11 @@ static int LuaFetch(lua_State *L) {
|
||||||
port = usessl ? "443" : "80";
|
port = usessl ? "443" : "80";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ip = ntohl(servers.p[0].addr.sin_addr.s_addr);
|
ip = servers.n ? ntohl(servers.p[0].addr.sin_addr.s_addr) : INADDR_LOOPBACK;
|
||||||
host =
|
host =
|
||||||
gc(xasprintf("%hhu.%hhu.%hhu.%hhu", ip >> 24, ip >> 16, ip >> 8, ip));
|
gc(xasprintf("%hhu.%hhu.%hhu.%hhu", ip >> 24, ip >> 16, ip >> 8, ip));
|
||||||
port = gc(xasprintf("%d", ntohs(servers.p[0].addr.sin_port)));
|
port =
|
||||||
|
gc(xasprintf("%d", servers.n ? ntohs(servers.p[0].addr.sin_port) : 80));
|
||||||
}
|
}
|
||||||
if (!IsAcceptableHost(host, -1)) {
|
if (!IsAcceptableHost(host, -1)) {
|
||||||
luaL_argerror(L, 1, "invalid host");
|
luaL_argerror(L, 1, "invalid host");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue