summaryrefslogtreecommitdiffstats
path: root/Doc/library/http.server.rst
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-03-16 04:13:56 (GMT)
committerLarry Hastings <larry@hastings.org>2014-03-16 04:13:56 (GMT)
commit3732ed24145c1ac77e99bcf85bccda3af095e696 (patch)
tree432a243f5f4d9720ec0cc202ee969f6175e450b7 /Doc/library/http.server.rst
parentb6b6a6d587d267cbad490232d08faebd30fdb7e2 (diff)
downloadcpython-3732ed24145c1ac77e99bcf85bccda3af095e696.zip
cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.gz
cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.bz2
Merge in all documentation changes since branching 3.4.0rc1.
Diffstat (limited to 'Doc/library/http.server.rst')
-rw-r--r--Doc/library/http.server.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst
index 0f7c8b3..dd19fb4 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -351,7 +351,7 @@ of which this module provides three different variants:
The :class:`SimpleHTTPRequestHandler` class can be used in the following
manner in order to create a very basic webserver serving files relative to
-the current directory. ::
+the current directory::
import http.server
import socketserver
@@ -365,15 +365,17 @@ the current directory. ::
print("serving at port", PORT)
httpd.serve_forever()
+.. _http-server-cli:
+
:mod:`http.server` can also be invoked directly using the :option:`-m`
switch of the interpreter with a ``port number`` argument. Similar to
-the previous example, this serves files relative to the current directory. ::
+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. ::
+By default, server binds itself to all interfaces. The option ``-b/--bind``
+specifies a specific address to which it should bind. For example, the
+following command causes the server to bind to localhost only::
python -m http.server 8000 --bind 127.0.0.1
@@ -422,7 +424,7 @@ restrict the server to bind only to localhost. ::
reasons. Problems with the CGI script will be translated to error 403.
:class:`CGIHTTPRequestHandler` can be enabled in the command line by passing
-the ``--cgi`` option.::
+the ``--cgi`` option::
python -m http.server --cgi 8000