aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bun.js/api/server.zig4
-rw-r--r--src/bun.js/http.exports.js5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig
index f4f4907f1..029ce6533 100644
--- a/src/bun.js/api/server.zig
+++ b/src/bun.js/api/server.zig
@@ -448,6 +448,7 @@ pub const ServerConfig = struct {
args.base_url = URL.parse(args.base_uri);
}
} else {
+
const hostname: string =
if (has_hostname and std.mem.span(args.hostname).len > 0) std.mem.span(args.hostname) else "0.0.0.0";
const protocol: string = if (args.ssl_config != null) "https" else "http";
@@ -4370,6 +4371,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type {
}
pub fn stopListening(this: *ThisServer, abrupt: bool) void {
+ httplog("stopListening", .{});
var listener = this.listener orelse return;
this.listener = null;
this.unref();
@@ -4434,6 +4436,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type {
}
noinline fn onListenFailed(this: *ThisServer) void {
+ httplog("onListenFailed", .{});
this.unref();
var zig_str: ZigString = ZigString.init("");
@@ -4709,6 +4712,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type {
}
pub fn listen(this: *ThisServer) void {
+ httplog("listen", .{});
if (ssl_enabled) {
BoringSSL.load();
const ssl_config = this.config.ssl_config orelse @panic("Assertion failure: ssl_config");
diff --git a/src/bun.js/http.exports.js b/src/bun.js/http.exports.js
index 1655fa09d..dd3745b30 100644
--- a/src/bun.js/http.exports.js
+++ b/src/bun.js/http.exports.js
@@ -43,13 +43,12 @@ export class Server extends EventEmitter {
const server = this;
if (typeof host === "function") {
onListen = host;
+ host = undefined;
}
if (typeof port === "function") {
onListen = port;
- }
-
- if (typeof port === "object") {
+ } else if (typeof port === "object") {
host = port?.host;
port = port?.port;
if (typeof port?.callback === "function") onListen = port?.callback;