mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -05:00
fix: net listen crashes on explicit undefined hostname (#7706)
This commit is contained in:
parent
df02e31507
commit
eaba9adb03
2 changed files with 13 additions and 2 deletions
|
@ -203,10 +203,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function listen(options) {
|
||||
function listen({ hostname, ...options }) {
|
||||
const res = opListen({
|
||||
transport: "tcp",
|
||||
hostname: "0.0.0.0",
|
||||
hostname: typeof hostname === "undefined" ? "0.0.0.0" : hostname,
|
||||
...options,
|
||||
});
|
||||
|
||||
|
|
|
@ -533,3 +533,14 @@ unitTest(
|
|||
await resolvable;
|
||||
},
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{
|
||||
perms: { net: true },
|
||||
},
|
||||
function netExplicitUndefinedHostname() {
|
||||
const listener = Deno.listen({ hostname: undefined, port: 8080 });
|
||||
assertEquals((listener.addr as Deno.NetAddr).hostname, "0.0.0.0");
|
||||
listener.close();
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue