Skip to content

Commit 11eaf0b

Browse files
committed
Fix being unable to use [::] for the host
Fixes #1582.
1 parent 8b5deac commit 11eaf0b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node/http.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,11 @@ export class HttpServer {
584584
const onListen = (): void => resolve(this.address())
585585
if (this.options.socket) {
586586
this.server.listen(this.options.socket, onListen)
587+
} else if (this.options.host) {
588+
// [] is the correct format when using :: but Node errors with them.
589+
this.server.listen(this.options.port, this.options.host.replace(/^\[|\]$/g, ""), onListen)
587590
} else {
588-
this.server.listen(this.options.port, this.options.host, onListen)
591+
this.server.listen(this.options.port, onListen)
589592
}
590593
})
591594
}

0 commit comments

Comments
 (0)