Skip to content

Keep HTTP/1 connection state after pipelined responses - #510

Merged
ericmj merged 1 commit into
mainfrom
keep-http1-state-after-pipelined-responses
Sep 24, 2026
Merged

ericmj merged 1 commit into
mainfrom
keep-http1-state-after-pipelined-responses

Conversation

@ericmj

@ericmj ericmj commented Sep 21, 2026

Copy link
Copy Markdown
Member

next_request/3 started the next queued response with decode(:status, %{conn | state: :status}, data, responses). decode/4 already takes the parser state as its first argument, and conn.state is the connection's own :open or :closed, so the struct update overwrote it with a parser state.

Once a response completed with another request in flight, open?/1 compared :status == :open and returned false, and close/1, whose clauses match :open and :closed, raised FunctionClauseError. Measured on the unfixed code: conn.state is :status after the first response, and HTTP1.close(conn) raises. Only pipelining reaches it: with nothing else in flight, next_request/3 matches its %{request: nil} clause, which buffers the rest and leaves the struct alone.

The test opens two requests, delivers the first response, and checks the connection is still open, the second response still parses, and close/1 works.

Parsing the next queued response overwrote the connection state with the
parser state, so open?/1 returned false and close/1 raised
FunctionClauseError once a response completed with another request in
flight.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 7

Coverage remained the same at 88.627%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1741
Covered Lines: 1543
Line Coverage: 88.63%
Coverage Strength: 550.56 hits per line

馃挍 - Coveralls

@ericmj
ericmj merged commit cce5f55 into main Sep 24, 2026
3 checks passed
@ericmj
ericmj deleted the keep-http1-state-after-pipelined-responses branch September 24, 2026 09:36
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.

3 participants