Skip to content

Recalculate ExtensionFrame body length when serializing - #169

Open
vitalivo wants to merge 1 commit into
python-hyper:masterfrom
vitalivo:fix/extension-frame-body-length
Open

Recalculate ExtensionFrame body length when serializing#169
vitalivo wants to merge 1 commit into
python-hyper:masterfrom
vitalivo:fix/extension-frame-body-length

Conversation

@vitalivo

Copy link
Copy Markdown

Serializing an ExtensionFrame constructed with body=b"hello" writes a zero-length header followed by five bytes. Changing the body of an already parsed frame similarly retains the old length.

Recalculate body_len during serialization, as the base Frame serializer does. The tests cover empty, short, and 256-byte initial bodies, then replace each body and round-trip the resulting wire frame.

All three regression cases fail before the fix. Full Python 3.12 suite: 151 passed, 100% branch coverage. Ruff and strict mypy pass. Includes a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant