summaryrefslogtreecommitdiff
path: root/Doc/library/http.server.rst
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2013-09-15 09:37:27 -0700
committerSenthil Kumaran <senthil@uthcode.com>2013-09-15 09:37:27 -0700
commit5e1be697737d442063044456245b1726c4faf1ce (patch)
treebcb745774c3be01cb487e69704cee0325ce6ce1f /Doc/library/http.server.rst
parent85fc9a165dccce036ce067d221d8cc18d119d870 (diff)
downloadcpython-5e1be697737d442063044456245b1726c4faf1ce.tar.gz
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.
Diffstat (limited to 'Doc/library/http.server.rst')
-rw-r--r--Doc/library/http.server.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst
index 53139a2239..ca66c40716 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -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)