Bump h2 to ~>0.10.0 and add HTTP/2 streaming bodies - #875
Merged
Conversation
Loosen the h2 requirement from a pinned 0.9.0 to ~>0.10.0 so all patched 0.10 releases are accepted without re-bumping each time. Add HTTP/2 support to the existing streaming API so it reaches parity with HTTP/1.1 and HTTP/3: body = stream then send_body/finish_send_body/ start_response/body/stream_body now stream the request body in DATA frames and read the response in full or chunk by chunk. The change is additive, every new clause is guarded on protocol = http2 and the one-shot path is untouched. Two fixes were needed for the streaming path: skip the streaming_body passive-socket setopts for h2 (the h2_connection process owns the socket and reads it in active mode), and cancel the pool keepalive timer on the streaming_body to connected transition so a slow streaming response is not torn down (same invariant as #836).
This was referenced Jun 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loosen the h2 requirement from a pinned 0.9.0 to ~>0.10.0 so all patched 0.10 releases are accepted without re-bumping.
Add HTTP/2 support to the existing streaming API so it reaches parity with HTTP/1.1 and HTTP/3. With
body = stream, the request body is sent in DATA frames viasend_body/2+finish_send_body/1, and the response is read withstart_response/1thenbody/1orstream_body/1. The change is additive: every new clause is guarded onprotocol = http2and the one-shot path is untouched.Two fixes were needed along the way:
streaming_body(enter,...)set the socket to passive, but for h2 theh2_connectionprocess owns the socket and reads it in active mode, so responses never arrived. The h2 enter clause now skips the setopts.streaming_body -> connectedtransition re-armed the pool keepalive timer that http/2 sometimes hangs #836 cancels for h2, which could tear down a slow streaming response. The transition now cancels it, same asstart_h2_connection.Tests in
test/hackney_http2_streaming_tests.erlcover a large streamed request echoed back intact, an empty streamed body, chunk-by-chunk response reads, and a one-shot regression guard.