summaryrefslogtreecommitdiff
path: root/ext/net/01_net.js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-07-25 15:26:18 +0900
committerGitHub <noreply@github.com>2023-07-25 06:26:18 +0000
commit3d3590063954dd30c1ebea02aad136878eeee04e (patch)
tree6bc5fd53d4aa4c0d1d88a715f5e2a019fc9bd64f /ext/net/01_net.js
parente311e46a8f80491bc0ab4bc5dfce55d78bdb7187 (diff)
fix(ext/net): fix string port number handling in listen (#19921)
While string `port` is not allowed in typing, it seems we used to support that and now it's broken. ref: https://github.com/denoland/deno/issues/10064#issuecomment-1637427260 This PR restores the support of string port number in `listen` and `listenTls`
Diffstat (limited to 'ext/net/01_net.js')
-rw-r--r--ext/net/01_net.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index e8ce3a300..9cdcdb78c 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -15,6 +15,7 @@ const {
ArrayPrototypeForEach,
ArrayPrototypePush,
Error,
+ Number,
ObjectPrototypeIsPrototypeOf,
PromiseResolve,
SymbolAsyncIterator,
@@ -420,7 +421,7 @@ function listen(args) {
case "tcp": {
const { 0: rid, 1: addr } = ops.op_net_listen_tcp({
hostname: args.hostname ?? "0.0.0.0",
- port: args.port,
+ port: Number(args.port),
}, args.reusePort);
addr.transport = "tcp";
return new Listener(rid, addr);