diff --git a/examples/trio-server.py b/examples/trio-server.py index 361a288..823de97 100644 --- a/examples/trio-server.py +++ b/examples/trio-server.py @@ -106,6 +106,7 @@ def format_date_time(dt=None): # I/O adapter: h11 <-> trio ################################################################ + # The core of this could be factored out to be usable for trio-based clients # too, as well as servers. But as a simplified pedagogical example we don't # attempt this here. @@ -212,6 +213,7 @@ def info(self, *args): # Server main loop ################################################################ + # General theory: # # If everything goes well: @@ -276,6 +278,7 @@ async def http_serve(stream): # Actual response handlers ################################################################ + # Helper function async def send_simple_response(wrapper, status_code, content_type, body): wrapper.info("Sending", status_code, "response with", len(body), "bytes") diff --git a/h11/_connection.py b/h11/_connection.py index d175270..9c66d2a 100644 --- a/h11/_connection.py +++ b/h11/_connection.py @@ -57,6 +57,7 @@ class PAUSED(Sentinel, metaclass=Sentinel): # - Apache: <8 KiB per line> DEFAULT_MAX_INCOMPLETE_EVENT_SIZE = 16 * 1024 + # RFC 7230's rules for connection lifecycles: # - If either side says they want to close the connection, then the connection # must close. diff --git a/h11/tests/test_connection.py b/h11/tests/test_connection.py index 73a27b9..d6b4fc9 100644 --- a/h11/tests/test_connection.py +++ b/h11/tests/test_connection.py @@ -594,7 +594,7 @@ def test_pipelining() -> None: def test_protocol_switch() -> None: - for (req, deny, accept) in [ + for req, deny, accept in [ ( Request( method="CONNECT", @@ -721,7 +721,7 @@ def setup() -> ConnectionPair: def test_close_simple() -> None: # Just immediately closing a new connection without anything having # happened yet. - for (who_shot_first, who_shot_second) in [(CLIENT, SERVER), (SERVER, CLIENT)]: + for who_shot_first, who_shot_second in [(CLIENT, SERVER), (SERVER, CLIENT)]: def setup() -> ConnectionPair: p = ConnectionPair() diff --git a/h11/tests/test_io.py b/h11/tests/test_io.py index 2b47c0e..2874122 100644 --- a/h11/tests/test_io.py +++ b/h11/tests/test_io.py @@ -125,12 +125,12 @@ def check(got: Any) -> None: def test_writers_simple() -> None: - for ((role, state), event, binary) in SIMPLE_CASES: + for (role, state), event, binary in SIMPLE_CASES: tw(WRITERS[role, state], event, binary) def test_readers_simple() -> None: - for ((role, state), event, binary) in SIMPLE_CASES: + for (role, state), event, binary in SIMPLE_CASES: tr(READERS[role, state], binary, event)