From 75ea1bd3463577efbae98eb93496a6d27dcd8441 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 30 May 2021 14:11:53 +0100 Subject: [PATCH] WebServer: Exit when the given port is invalid Similar to an invalid listen address, we should not fallback to the default port (8000) but instead exit with an error. --- Userland/Services/WebServer/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp index e050424cb7..573f690fbc 100644 --- a/Userland/Services/WebServer/main.cpp +++ b/Userland/Services/WebServer/main.cpp @@ -35,8 +35,8 @@ int main(int argc, char** argv) } if ((u16)port != port) { - outln("Warning: Invalid port number: {}", port); - port = default_port; + warnln("Invalid port number: {}", port); + return 1; } auto real_root_path = Core::File::real_path_for(root_path);