Return responses before an error in the order they were parsed - #509
Merged
Merged
Conversation
HTTP1.handle_data/2 and the HTTP2 stream/2 and recv/3 catch clauses
reversed the accumulated responses only on the success path, so the
responses in {:error, conn, error, responses} came back newest first.
The docs describe them as the responses parsed before the error.
Coverage Report for CI Build 0Coverage remained the same at 88.627%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
馃挍 - Coveralls |
whatyouhide
approved these changes
Sep 24, 2026
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.
stream/2andrecv/3documentresponsesin{:error, conn, reason, responses}as "a list of responses that were correctly parsed before the error", in the same order as the{:ok, conn, responses}list.HTTP1.handle_data/2and the two HTTP/2 catch clauses reversed the accumulator only on the success path, so on the error path the list came back newest first:{:done, ref}before{:status, ref, 200}.A caller that walks the list in order, or takes
List.first/1to find the status, gets the wrong answer, and only on the error path, which is the path least likely to be covered by a caller's tests.Two tests, one per protocol: a chunked HTTP/1 response with a bad chunk size after the first chunk, and an HTTP/2 response followed by a GOAWAY. The existing
max_header_list_sizetest intest/mint/http1/conn_test.exsand the WINDOW_UPDATE test intest/mint/http2/conn_test.exsasserted the reversed order and now assert parse order.