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
commitdefe7f4c62b992380fdda2833bb46a6505c839f4 (patch)
treedb470d7591c9fa72ff25f4b8c052dcb78c2cccf7 /Doc/library/http.server.rst
parent5642ff9d8eefb0068eeb99c31320d3c6a319ea88 (diff)
downloadcpython-git-defe7f4c62b992380fdda2833bb46a6505c839f4.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)