Skip to content

Comments

Always send lowlevel_error response to client (#2731)#2

Open
MitchLewis930 wants to merge 1 commit intopr_052_beforefrom
pr_052_after
Open

Always send lowlevel_error response to client (#2731)#2
MitchLewis930 wants to merge 1 commit intopr_052_beforefrom
pr_052_after

Conversation

@MitchLewis930
Copy link

PR_052

* 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>
@MitchLewis930 MitchLewis930 requested a review from Copilot January 31, 2026 01:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_error to capture and send the response from lowlevel_error to the client
  • Extracted response writing logic into a new write_response method 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.

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.

2 participants