socketry / protocol-http2

MIT License
9 stars 10 forks source link

Ensure wire always contains a full H/2 frame (#15) #19

Open ioquatix opened 1 month ago

ioquatix commented 1 month ago

Use atomic operations for reading frames.

If reading the payload of a frame times out (after reading the header), it puts the stream in an odd state.

Fixes https://github.com/socketry/protocol-http2/issues/14.

Types of Changes

Contribution

ioquatix commented 1 month ago

@maruth-stripe @fables-tales I'm considering this PR again.

Not only do we have instances of read_header + read_payload, we also have instances where we have continuation frames on the wire, which have no meaning once the original frames are read. The latter case concerns me, as we can't easily protect against that. We can still do our best to only read full frames, but that won't correspond to a full semantic interpretation of headers + continuation frames - and it isn't possible to read continuation frames in isolation.