summaryrefslogtreecommitdiff
path: root/Doc/library/http.server.rst
diff options
context:
space:
mode:
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 ae7fb970de..fb5c1df611 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -98,8 +98,8 @@ of which this module provides three different variants:
.. attribute:: rfile
- Contains an input stream, positioned at the start of the optional input
- data.
+ An :class:`io.BufferedIOBase` input stream, ready to read from
+ the start of the optional input data.
.. attribute:: wfile
@@ -107,6 +107,9 @@ of which this module provides three different variants:
client. Proper adherence to the HTTP protocol must be used when writing to
this stream.
+ .. versionchanged:: 3.6
+ This is an :class:`io.BufferedIOBase` stream.
+
:class:`BaseHTTPRequestHandler` has the following attributes:
.. attribute:: server_version
@@ -369,10 +372,9 @@ the current directory::
Handler = http.server.SimpleHTTPRequestHandler
- httpd = socketserver.TCPServer(("", PORT), Handler)
-
- print("serving at port", PORT)
- httpd.serve_forever()
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
+ print("serving at port", PORT)
+ httpd.serve_forever()
.. _http-server-cli: