diff options
author | Géry Ogam <gery.ogam@gmail.com> | 2022-05-02 22:28:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 22:28:45 (GMT) |
commit | 2d30adee72317e569d24739243cdd6f7631fa68f (patch) | |
tree | 33aa34add4ebd735aceed5c2b6e835f1f9448398 /Doc/library | |
parent | 32e4f450af3fbcc5c7e186f83ff74e2efe164136 (diff) | |
download | cpython-2d30adee72317e569d24739243cdd6f7631fa68f.zip cpython-2d30adee72317e569d24739243cdd6f7631fa68f.tar.gz cpython-2d30adee72317e569d24739243cdd6f7631fa68f.tar.bz2 |
bpo-46285: Add command-line option -p/--protocol to module http.server (#30999)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/http.server.rst | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst index 0de0283..9d5e5e3 100644 --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -157,7 +157,9 @@ provides three different variants: .. attribute:: protocol_version - This specifies the HTTP protocol version used in responses. If set to + Specifies the HTTP version to which the server is conformant. It is sent + in responses to let the client know the server's communication + capabilities for future requests. If set to ``'HTTP/1.1'``, the server will permit HTTP persistent connections; however, your server *must* then include an accurate ``Content-Length`` header (using :meth:`send_header`) in all of its responses to clients. @@ -193,7 +195,7 @@ provides three different variants: .. method:: handle_expect_100() - When a HTTP/1.1 compliant server receives an ``Expect: 100-continue`` + When an HTTP/1.1 conformant server receives an ``Expect: 100-continue`` request header it responds back with a ``100 Continue`` followed by ``200 OK`` headers. This method can be overridden to raise an error if the server does not @@ -444,6 +446,15 @@ the following command uses a specific directory:: .. versionadded:: 3.7 ``--directory`` argument was introduced. +By default, the server is conformant to HTTP/1.0. The option ``-p/--protocol`` +specifies the HTTP version to which the server is conformant. For example, the +following command runs an HTTP/1.1 conformant server:: + + python -m http.server --protocol HTTP/1.1 + +.. versionadded:: 3.11 + ``--protocol`` argument was introduced. + .. class:: CGIHTTPRequestHandler(request, client_address, server) This class is used to serve either files or output of CGI scripts from the |