Skip to content

Fix test_max_incomplete_event_size_countermeasure test #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion h11/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ def test_max_incomplete_event_size_countermeasure() -> None:
c = Connection(SERVER, max_incomplete_event_size=5000)
c.receive_data(b"GET / HTTP/1.0\r\nBig: ")
c.receive_data(b"a" * 4000)
assert get_all_events(c) == []

c.receive_data(b"\r\n\r\n")
assert get_all_events(c) == [
Request(
Expand All @@ -437,7 +439,7 @@ def test_max_incomplete_event_size_countermeasure() -> None:
c.receive_data(b"GET / HTTP/1.0\r\nBig: ")
c.receive_data(b"a" * 4000)
with pytest.raises(RemoteProtocolError):
c.next_event()
get_all_events(c)

# Temporarily exceeding the size limit is fine, as long as its done with
# complete events:
Expand Down