Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/h2/frame_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def __next__(self) -> Frame:

# At this point, as we know we'll use or discard the entire frame, we
# can update the data.
self._data = self._data[9+length:]
del self._data[:9+length]

# Pass the frame through the header buffer.
new_frame = self._update_header_buffer(f)
Expand Down
14 changes: 14 additions & 0 deletions tests/test_basic_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
from . import helpers


class TestFrameBuffer:
def test_consumed_frames_are_removed_in_place(self) -> None:
frame = hyperframe.frame.SettingsFrame(0).serialize()
buffer = h2.frame_buffer.FrameBuffer()
buffer.max_frame_size = 65535
buffer.add_data(frame * 2)
data = buffer._data

next(buffer)

assert buffer._data is data
assert buffer._data == frame


class TestBasicClient:
"""
Basic client-side tests.
Expand Down