Skip to content

Commit d3f9b02

Browse files
committed
Fix typos discovered by codespell
1 parent 62c5068 commit d3f9b02

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

docs/source/api.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ A basic HTTP request/response cycle looks like this:
202202
* and a :class:`EndOfMessage` event.
203203

204204
And once that's finished, both sides either close the connection, or
205-
they go back to the top and re-use it for another request/response
205+
they go back to the top and reuse it for another request/response
206206
cycle.
207207

208208
To coordinate this interaction, the h11 :class:`Connection` object
@@ -281,7 +281,7 @@ what's needed to handle the basic request/response cycle:
281281

282282
* Server sending a :class:`Response` directly from :data:`IDLE`: This
283283
is used for error responses, when the client's request never arrived
284-
(e.g. 408 Request Timed Out) or was unparseable gibberish (400 Bad
284+
(e.g. 408 Request Timed Out) or was unparsable gibberish (400 Bad
285285
Request) and thus didn't register with our state machine as a real
286286
:class:`Request`.
287287

@@ -471,7 +471,7 @@ There are four cases where these exceptions might be raised:
471471

472472
* When calling :meth:`Connection.start_next_cycle`
473473
(:exc:`LocalProtocolError`): This indicates that the connection is
474-
not ready to be re-used, because one or both of the peers are not in
474+
not ready to be reused, because one or both of the peers are not in
475475
the :data:`DONE` state. The :class:`Connection` object remains
476476
usable, and you can try again later.
477477

@@ -507,7 +507,7 @@ the remote peer. But sometimes, for one reason or another, this
507507
doesn't actually happen.
508508

509509
Here's a concrete example. Suppose you're using h11 to implement an
510-
HTTP client that keeps a pool of connections so it can re-use them
510+
HTTP client that keeps a pool of connections so it can reuse them
511511
when possible (see :ref:`keepalive-and-pipelining`). You take a
512512
connection from the pool, and start to do a large upload... but then
513513
for some reason this gets cancelled (maybe you have a GUI and a user
@@ -518,7 +518,7 @@ successfully sent the full request, because you passed an
518518
you didn't, because you never sent the resulting bytes. And then –
519519
here's the really tricky part! – if you're not careful, you might
520520
think that it's OK to put this connection back into the connection
521-
pool and re-use it, because h11 is telling you that a full
521+
pool and reuse it, because h11 is telling you that a full
522522
request/response cycle was completed. But this is wrong; in fact you
523523
have to close this connection and open a new one.
524524

@@ -605,10 +605,10 @@ cases:
605605

606606
.. _keepalive-and-pipelining:
607607

608-
Re-using a connection: keep-alive and pipelining
608+
Reusing a connection: keep-alive and pipelining
609609
------------------------------------------------
610610

611-
HTTP/1.1 allows a connection to be re-used for multiple
611+
HTTP/1.1 allows a connection to be reused for multiple
612612
request/response cycles (also known as "keep-alive"). This can make
613613
things faster by letting us skip the costly connection setup, but it
614614
does create some complexities: we have to keep track of whether a
@@ -635,7 +635,7 @@ these cases -- h11 will automatically add this header when
635635
necessary. Just worry about setting it when it's actually something
636636
that you're actively choosing.
637637

638-
If you want to re-use a connection, you have to wait until both the
638+
If you want to reuse a connection, you have to wait until both the
639639
request and the response have been completed, bringing both the client
640640
and server to the :data:`DONE` state. Once this has happened, you can
641641
explicitly call :meth:`Connection.start_next_cycle` to reset both
@@ -651,7 +651,7 @@ skip past the :data:`DONE` state directly to the :data:`MUST_CLOSE` or
651651
thing you can legally do is to close this connection and make a new
652652
one.
653653

654-
HTTP/1.1 also allows for a more aggressive form of connection re-use,
654+
HTTP/1.1 also allows for a more aggressive form of connection reuse,
655655
in which a client sends multiple requests in quick succession, and
656656
then waits for the responses to stream back in order
657657
("pipelining"). This is generally considered to have been a bad idea,

docs/source/basic-usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ For some servers, we'd have to stop here, because they require a new
286286
connection for every request/response. But, this server is smarter
287287
than that -- it supports `keep-alive
288288
<https://en.wikipedia.org/wiki/HTTP_persistent_connection>`_, so we
289-
can re-use this connection to send another request. There's a few ways
289+
can reuse this connection to send another request. There's a few ways
290290
we can tell. First, if it didn't, then it would have closed the
291291
connection already, and we would have gotten a
292292
:class:`ConnectionClosed` event on our last call to

docs/source/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Backwards compatible changes:
293293
originates locally (which produce a 500 status code) versus errors
294294
caused by remote misbehavior (which produce a 4xx status code).
295295

296-
* Changed the :data:`PRODUCT_ID` from ``h11/<verson>`` to
296+
* Changed the :data:`PRODUCT_ID` from ``h11/<version>`` to
297297
``python-h11/<version>``. (This is similar to what requests uses,
298298
and much more searchable than plain h11.)
299299

examples/trio-server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#
4242
# - The error handling policy here is somewhat crude as well. It handles a lot
4343
# of cases perfectly, but there are corner cases where the ideal behavior is
44-
# more debateable. For example, if a client starts uploading a large
44+
# more debatable. For example, if a client starts uploading a large
4545
# request, uses 100-Continue, and we send an error response, then we'll shut
4646
# down the connection immediately (for well-behaved clients) or after
4747
# spending TIMEOUT seconds reading and discarding their upload (for
@@ -54,7 +54,7 @@
5454
# and wasting your bandwidth if this is what it takes to guarantee that they
5555
# see your error response. Up to you, really.
5656
#
57-
# - Another example of a debateable choice: if a response handler errors out
57+
# - Another example of a debatable choice: if a response handler errors out
5858
# without having done *anything* -- hasn't started responding, hasn't read
5959
# the request body -- then this connection actually is salvagable, if the
6060
# server sends an error response + reads and discards the request body. This
@@ -262,7 +262,7 @@ async def http_serve(stream):
262262
return
263263
else:
264264
try:
265-
wrapper.info("trying to re-use connection")
265+
wrapper.info("trying to reuse connection")
266266
wrapper.conn.start_next_cycle()
267267
except h11.ProtocolError:
268268
states = wrapper.conn.states

h11/_headers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# message"
4545
# (and there are several headers where the order indicates a preference)
4646
#
47-
# Multiple occurences of the same header:
47+
# Multiple occurrences of the same header:
4848
# "A sender MUST NOT generate multiple header fields with the same field name
4949
# in a message unless either the entire field value for that header field is
5050
# defined as a comma-separated list [or the header is Set-Cookie which gets a
@@ -81,7 +81,7 @@ class Headers(Sequence[Tuple[bytes, bytes]]):
8181
8282
Internally we actually store the representation as three-tuples,
8383
including both the raw original casing, in order to preserve casing
84-
over-the-wire, and the lowercased name, for case-insensitive comparisions.
84+
over-the-wire, and the lowercased name, for case-insensitive comparisons.
8585
8686
r = Request(
8787
method="GET",

h11/tests/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def setup() -> ConnectionPair:
652652
for conn in p.conns:
653653
assert conn.states == {CLIENT: DONE, SERVER: SEND_BODY}
654654
p.send(SERVER, EndOfMessage())
655-
# Check that re-use is still allowed after a denial
655+
# Check that reuse is still allowed after a denial
656656
for conn in p.conns:
657657
conn.start_next_cycle()
658658

h11/tests/test_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_ConnectionState_reuse() -> None:
239239
with pytest.raises(LocalProtocolError):
240240
cs.start_next_cycle()
241241

242-
# Succesful protocol switch
242+
# Successful protocol switch
243243

244244
cs = ConnectionState()
245245
cs.process_client_switch_proposal(_SWITCH_UPGRADE)

0 commit comments

Comments
 (0)