Skip to content

Commit 3a31cca

Browse files
committed
Issue python#24902: Print server URL on http.server startup
Initial patch by Felix Kaiser.
1 parent 955bc38 commit 3a31cca

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎Lib/http/server.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,8 @@ def test(HandlerClass=BaseHTTPRequestHandler,
11771177
HandlerClass.protocol_version = protocol
11781178
with ServerClass(server_address, HandlerClass) as httpd:
11791179
sa = httpd.socket.getsockname()
1180-
print("Serving HTTP on", sa[0], "port", sa[1], "...")
1180+
serve_message = "Serving HTTP on {host} port {port} (http://{host}:{port}/) ..."
1181+
print(serve_message.format(host=sa[0], port=sa[1]))
11811182
try:
11821183
httpd.serve_forever()
11831184
except KeyboardInterrupt:

‎Misc/NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ Core and Builtins
256256
Library
257257
-------
258258

259+
- Issue #24902: Print server URL on http.server startup. Initial patch by
260+
Felix Kaiser.
261+
259262
- Issue #25788: fileinput.hook_encoded() now supports an "errors" argument
260263
for passing to open. Original patch by Joseph Hackman.
261264

0 commit comments

Comments
 (0)