Repository navigation
Conversation
|
Review: NEEDS CHANGES at |
…d-size payload (#2274) HTTP.make defaulted frame to b'', packed verbatim with Length 0, so PRIORITY, RST_STREAM, PUSH_PROMISE, PING, GOAWAY and WINDOW_UPDATE could not be read back and HTTP(type=<T>, sid=...) raised. HTTP._make_http_settings also raised on settings=None, though RFC 9113 section 6.5 permits a SETTINGS frame carrying no parameters. frame now defaults to None, dispatching to the frame type's own _make_http_* constructor -- the same as passing frame={} -- while an explicit b'' still packs raw, unchanged. _make_http_settings treats settings=None as no parameters rather than raising. Chosen over raising a clearer error: every other make default already produces a valid packet, so a well-worded exception on the default call would still have been an API wart dressed up as a diagnostic. Dispatching makes the default and frame={} byte-identical for every frame type, at no extra cost since each constructor already has working per-field defaults. Tests: test_httpv2_frame_default_2274_unit.py pins the octets all ten frame types emit by default, that they match frame={} and round-trip, that explicit bytes stay raw, and both empty and populated SETTINGS frames. test_http_unit.py's constructor sweep now pins settings=None building rather than raising, and test_http_message_prefix_2298_unit.py and test_httpv2_error_default_2311_unit.py are updated for prose and cases that pinned the old behaviour.
b116d3b to
30a6030
Compare
|
Amended |
|
Review: GOOD TO GO at |
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix — bug fixDescription
Closes #2274.
HTTP.makedefaultedframetob'', packed verbatim withLength 0, soPRIORITY,RST_STREAM,PUSH_PROMISE,PING,GOAWAYandWINDOW_UPDATEcould not be read back andHTTP(type=<T>, sid=...)raised._make_http_settingsalso raised onsettings=None, though RFC 9113 §6.5 permits aSETTINGSframe carrying no parameters.framenow defaults toNone, dispatching to the frame type's own_make_http_*constructor — the same asframe={}— while an explicitb''still packs raw, unchanged._make_http_settingstreatssettings=Noneas no parameters.makedefault already produces a valid packet, so a well-worded exception would still be an API wart; dispatching costs nothing since each constructor already has working per-field defaults, and it makes the default andframe={}byte-identical for every frame type.test_httpv2_frame_default_2274_unit.pypins the octets all ten frame types emit by default, that they matchframe={}and round-trip, that explicit bytes stay raw, and both empty and populatedSETTINGSframes.test_http_unit.py's constructor sweep now pinssettings=Nonebuilding rather than raising;test_http_message_prefix_2298_unit.pyandtest_httpv2_error_default_2311_unit.pyupdated for the prose/cases that pinned the old behaviour.