Fix http-server on Windows

This commit is contained in:
Joshua Granick
2015-03-23 16:31:02 -07:00
parent 12528a53bc
commit 54d8d5eee3
2 changed files with 23 additions and 12 deletions

View File

@@ -81,16 +81,19 @@ function listen(port) {
var server = httpServer.createServer(options);
server.listen(port, host, function() {
var uri = [ssl ? 'https' : 'http', '://', host, ':', port].join('');
var protocol = ssl ? 'https:' : 'http:';
var canonical_host = host === "0.0.0.0" ? "localhost" : host;
var uri = protocol + '//' + host + ':' + port;
var canonical_uri = protocol + '//' + canonical_host + ':' + port;
log('Starting up http-server, serving '.yellow
+ server.root.cyan
+ ((ssl) ? ' through'.yellow + ' https'.cyan : '')
+ (ssl ? ' through'.yellow + ' https'.cyan : '')
+ ' on: '.yellow
+ uri.cyan);
log('Hit CTRL-C to stop the server');
if (argv.o) {
opener(uri);
opener(canonical_uri);
}
});
}