Skip to content

Commit 9b0a8f6

Browse files
authored
Improve discoverability when --port=0 is used (#1890)
1 parent bb1b50f commit 9b0a8f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

uvicorn/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def bind_socket(self) -> socket.socket:
571571
+ " (Press CTRL+C to quit)"
572572
)
573573
protocol_name = "https" if self.is_ssl else "http"
574-
logger_args = [protocol_name, self.host, self.port]
574+
logger_args = [protocol_name, self.host, sock.getsockname()[1]]
575575
logger.info(message, *logger_args, extra={"color_message": color_message})
576576
sock.set_inheritable(True)
577577
return sock

0 commit comments

Comments
 (0)