Skip to content

Phase 5: streaming edge cases - #18

Open
Piyush-Goenka wants to merge 1 commit into
rage-rb:http-streamingfrom
Piyush-Goenka:Phase-5
Open

Phase 5: streaming edge cases#18
Piyush-Goenka wants to merge 1 commit into
rage-rb:http-streamingfrom
Piyush-Goenka:Phase-5

Conversation

@Piyush-Goenka

Copy link
Copy Markdown

Summary

Closes out the remaining edge cases from the streaming behavior matrix.

HEAD request body suppression

A HEAD request to a call(stream) endpoint previously started chunked framing and sent body chunks, violating RFC 9110 and desyncing keep-alive clients. The callable is now never invoked (mirroring Rack::Head): the body is closed if it responds to close and the response completes headers-only.

GC safety for RackStream

RackStream held its C context as a raw pointer with no free function, so a stream dropped without close leaked the context and left the connection wedged in streaming mode until the client gave up. The class now uses TypedData with a finalizer that finishes the response when the connection is still alive. Testing this exposed a second issue: the stream's last reference could survive in a machine-stack slot and get pinned by the conservative GC scan, so the slot is now explicitly cleared after the callable returns.

Tests

Three new integration specs (HEAD suppression, keep-alive reuse after HEAD, GC collection finishing an abandoned stream). Full suite: 128 examples, 0 failures.

A full audit of the 35-case behavior matrix (evidence per case) was done as part of this work.

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