Repository navigation
fix(endpoint): set connection close header on reraised errors - #6866
Open
javiergarea wants to merge 1 commit into
Open
javiergarea wants to merge 1 commit into
javiergarea wants to merge 1 commit into
Conversation
Member
|
Since Bandit and Cowboy are the ones that close the connection, can't they ensure the header is set? |
Author
That was my first thought too, but the timing seems to get in the way:
The error reaches the server at step 4, but the headers are gone since step 2. |
This branch has not been deployed
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.
Closes #6859
Description
RenderErrorsrenders the error response and then reraises, after which bothbanditandcowboyclose the HTTP/1 connection.The response never advertised the closure, so clients reusing the connection hit resets.
Per RFC 9112 §9.6, this PR sets
connection: closeon error responses that will be reraised.NoRouteErroris not reraised, so no header is added thereManual validation
Server, from a
phoenixcheckout (MIX_ENV=test iex -S mix):Client, in a separate plain
iex:On this branch, both adapters:
On main, both adapters: the same minus the
connectionheader.