瀏覽代碼

WebServer: Show the correct port when using port 0

Specifying port 0 on the command line causes WebServer to select a
random available port. We now show the port WebServer is actually
using rather than assuming it is the same as the command line argument.
Tim Ledbetter 2 年之前
父節點
當前提交
f02ccffaa8
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Services/WebServer/main.cpp

+ 2 - 2
Userland/Services/WebServer/main.cpp

@@ -96,8 +96,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     TRY(server->listen(ipv4_address.value(), port));
 
     out("Listening on ");
-    out("\033]8;;http://{}:{}\033\\", ipv4_address.value(), port);
-    out("{}:{}", ipv4_address.value(), port);
+    out("\033]8;;http://{}:{}\033\\", ipv4_address.value(), server->local_port());
+    out("{}:{}", ipv4_address.value(), server->local_port());
     outln("\033]8;;\033\\");
 
     TRY(Core::System::unveil("/etc/timezone", "r"));