mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Expose --bind argument for http.server, enable http.server to bind to a user
specified network interface. Patch contributed by Malte Swart. Addresses issue #17764. HG :Enter commit message. Lines beginning with 'HG:' are removed.
This commit is contained in:
parent
5642ff9d8e
commit
defe7f4c62
3 changed files with 21 additions and 5 deletions
|
@ -368,6 +368,15 @@ the previous example, this serves files relative to the current directory. ::
|
|||
|
||||
python -m http.server 8000
|
||||
|
||||
By default, server binds itself to all interfaces. To restrict it to bind to a
|
||||
particular interface only, ``--bind ADDRESS`` argument can be used. For e.g, to
|
||||
restrict the server to bind only to localhost. ::
|
||||
|
||||
python -m http.server 8000 --bind 127.0.0.1
|
||||
|
||||
.. versionadded:: 3.4
|
||||
``--bind`` argument was introduced.
|
||||
|
||||
|
||||
.. class:: CGIHTTPRequestHandler(request, client_address, server)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue