From dfe242cb113d69a3ab674781cbcf2a9d765c8369 Mon Sep 17 00:00:00 2001 From: Robb Traister Date: Tue, 7 Mar 2023 08:52:15 -0500 Subject: [PATCH] improve discoverability when requesting any open port (via :0) --- uvicorn/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/config.py b/uvicorn/config.py index 4692b5809..bd041eccf 100644 --- a/uvicorn/config.py +++ b/uvicorn/config.py @@ -571,7 +571,7 @@ def bind_socket(self) -> socket.socket: + " (Press CTRL+C to quit)" ) protocol_name = "https" if self.is_ssl else "http" - logger_args = [protocol_name, self.host, self.port] + logger_args = [protocol_name, self.host, sock.getsockname()[1]] logger.info(message, *logger_args, extra={"color_message": color_message}) sock.set_inheritable(True) return sock