mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-24 10:18:43 +00:00
Server: correctly print URL when running on IPv6
Since https://github.com/nodejs/node/issues/40537 users are more likely to encounter IPv6 connections. IPv6 URLs require square brackets around raw addresses. With this change VS Code correctly hyperlinks the message `Serving on http://[::1]:8080`
This commit is contained in:
@@ -359,8 +359,9 @@ Server.prototype.listen = function(port,host,prefix) {
|
|||||||
}
|
}
|
||||||
// Display the port number after we've started listening (the port number might have been specified as zero, in which case we will get an assigned port)
|
// Display the port number after we've started listening (the port number might have been specified as zero, in which case we will get an assigned port)
|
||||||
server.on("listening",function() {
|
server.on("listening",function() {
|
||||||
var address = server.address();
|
var address = server.address(),
|
||||||
$tw.utils.log("Serving on " + self.protocol + "://" + address.address + ":" + address.port + prefix,"brown/orange");
|
url = self.protocol + "://" + (address.family === "IPv6" ? "[" + address.address + "]" : address.address) + ":" + address.port + prefix;
|
||||||
|
$tw.utils.log("Serving on " + url,"brown/orange");
|
||||||
$tw.utils.log("(press ctrl-C to exit)","red");
|
$tw.utils.log("(press ctrl-C to exit)","red");
|
||||||
});
|
});
|
||||||
// Listen
|
// Listen
|
||||||
|
|||||||
Reference in New Issue
Block a user