Always send lowlevel_error response to client (#2731)#2
Open
MitchLewis930 wants to merge 1 commit intopr_052_beforefrom
Open
Always send lowlevel_error response to client (#2731)#2MitchLewis930 wants to merge 1 commit intopr_052_beforefrom
MitchLewis930 wants to merge 1 commit intopr_052_beforefrom
Conversation
* Always send lowlevel_error response to client * Add spec for lowlever error handler * Make sure we have a clean buffer when starting response * Simplify test * Rename spec * Add method docs * Tweak the test * Return 500 from lowlevel_error_handler in test Co-authored-by: Patrik Ragnarsson <patrik@starkast.net>
There was a problem hiding this comment.
Pull request overview
This PR ensures that low-level error responses are consistently sent to clients using the custom lowlevel_error_handler when configured. Previously, errors in client_error would call lowlevel_error but not send the response to the client.
Changes:
- Modified
client_errorto capture and send the response fromlowlevel_errorto the client - Extracted response writing logic into a new
write_responsemethod to be shared between normal request handling and error handling - Updated tests to verify HTTP protocol version matching (1.0 vs 1.1) in error responses
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/puma/server.rb | Updated client_error to send lowlevel_error responses to client; modified lowlevel_error to normalize return values |
| lib/puma/request.rb | Extracted write_response method from handle_request to enable reuse in error handling |
| test/test_response_header.rb | Corrected expected HTTP version from 1.1 to 1.0 in error response assertions |
| test/test_puma_server.rb | Added test case verifying custom lowlevel_error_handler responses are sent to client |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
PR_052