Skip to content

Commit 88baea8

Browse files
[3.15] Fix various typos in the http.server docs (GH-153089) (#153096)
(cherry picked from commit 99b4cdb) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent f7eda8e commit 88baea8

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

Doc/library/http.server.rst

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ handler. Code to create and run the server looks like this::
7070
object fails with a :exc:`RuntimeError`.
7171

7272
The *certfile* argument is the path to the SSL certificate chain file,
73-
and the *keyfile* is the path to file containing the private key.
73+
and the *keyfile* is the path to the file containing the private key.
7474

7575
A *password* can be specified for files protected and wrapped with PKCS#8,
7676
but beware that this could possibly expose hardcoded passwords in clear.
@@ -150,7 +150,7 @@ instantiation, of which this module provides three different variants:
150150

151151
.. attribute:: path
152152

153-
Contains the request path. If query component of the URL is present,
153+
Contains the request path. If the query component of the URL is present,
154154
then ``path`` includes the query. Using the terminology of :rfc:`3986`,
155155
``path`` here includes ``hier-part`` and the ``query``.
156156

@@ -200,7 +200,7 @@ instantiation, of which this module provides three different variants:
200200
Specifies a format string that should be used by :meth:`send_error` method
201201
for building an error response to the client. The string is filled by
202202
default with variables from :attr:`responses` based on the status code
203-
that passed to :meth:`send_error`.
203+
passed to :meth:`send_error`.
204204

205205
.. attribute:: error_content_type
206206

@@ -248,8 +248,8 @@ instantiation, of which this module provides three different variants:
248248
.. method:: handle_expect_100()
249249

250250
When an HTTP/1.1 conformant server receives an ``Expect: 100-continue``
251-
request header it responds back with a ``100 Continue`` followed by ``200
252-
OK`` headers.
251+
request header it responds with a ``100 Continue`` followed by ``200 OK``
252+
headers.
253253
This method can be overridden to raise an error if the server does not
254254
want the client to continue. For example, the server can choose to send ``417
255255
Expectation Failed`` as a response header and ``return False``.
@@ -305,8 +305,8 @@ instantiation, of which this module provides three different variants:
305305
.. method:: send_response_only(code, message=None)
306306

307307
Sends the response header only, used for the purposes when ``100
308-
Continue`` response is sent by the server to the client. The headers not
309-
buffered and sent directly the output stream.If the *message* is not
308+
Continue`` response is sent by the server to the client. The headers are
309+
not buffered and sent directly the output stream. If the *message* is not
310310
specified, the HTTP message corresponding the response *code* is sent.
311311

312312
This method does not reject *message* containing CRLF sequences.
@@ -348,7 +348,7 @@ instantiation, of which this module provides three different variants:
348348
to create custom error logging mechanisms. The *format* argument is a
349349
standard printf-style format string, where the additional arguments to
350350
:meth:`log_message` are applied as inputs to the formatting. The client
351-
ip address and current date and time are prefixed to every message logged.
351+
IP address and current date and time are prefixed to every message logged.
352352

353353
.. method:: version_string()
354354

@@ -452,7 +452,7 @@ instantiation, of which this module provides three different variants:
452452
The request is mapped to a local file by interpreting the request as a
453453
path relative to the current working directory.
454454

455-
If the request was mapped to a directory, the directory is checked for a
455+
If the request was mapped to a directory, the directory is checked for
456456
an index page as specified by :attr:`index_pages`. If found, the
457457
file's contents are returned; otherwise a directory listing is generated
458458
by calling the :meth:`list_directory` method. This method uses
@@ -507,9 +507,8 @@ instantiation, of which this module provides three different variants:
507507
Add :func:`mimetypes.guess_file_type` as a fallback.
508508

509509

510-
The :class:`SimpleHTTPRequestHandler` class can be used in the following
511-
manner in order to create a very basic webserver serving files relative to
512-
the current directory::
510+
The :class:`SimpleHTTPRequestHandler` class can be used to create a very basic
511+
webserver serving files relative to the current directory as follows::
513512

514513
import http.server
515514
import socketserver
@@ -641,8 +640,8 @@ The following options are accepted:
641640

642641
.. option:: -H, --header <header> <value>
643642

644-
Specify an additional extra HTTP Response Header to send on successful HTTP
645-
200 responses. Can be used multiple times to send additional custom response
643+
Specify an additional HTTP Response Header to send on successful HTTP 200
644+
responses. Can be used multiple times to send additional custom response
646645
headers. Headers that are sent automatically by the server (for instance
647646
Content-Type) will not be overwritten by the server.
648647

@@ -657,13 +656,13 @@ Security considerations
657656
.. index:: pair: http.server; security
658657

659658
:class:`SimpleHTTPRequestHandler` will follow symbolic links when handling
660-
requests, this makes it possible for files outside of the specified directory
659+
requests which makes it possible for files outside of the specified directory
661660
to be served.
662661

663662
Methods :meth:`BaseHTTPRequestHandler.send_header` and
664663
:meth:`BaseHTTPRequestHandler.send_response_only` assume sanitized input
665664
and do not perform input validation such as checking for the presence of CRLF
666-
sequences. Untrusted input may result in HTTP Header injection attacks.
665+
sequences. Untrusted input may result in HTTP header injection attacks.
667666

668667
Earlier versions of Python did not scrub control characters from the
669668
log messages emitted to stderr from ``python -m http.server`` or the

0 commit comments

Comments
 (0)