Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose body read timeouts as 408 Request Timeout errors #385

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

mtrudel
Copy link
Owner

@mtrudel mtrudel commented Aug 1, 2024

Fixes #384

@mtrudel
Copy link
Owner Author

mtrudel commented Aug 1, 2024

This solution explicitly raises an HTTPError because returning an error tuple from Plug.Conn.Adapter.read_req_body/2 doesn't provide us with a way to track the failed read on the connection, so there's no way to meaningfully manage the connection once this happens. This puts a lot of onus on the user to properly ensure that nothing further gets done on the connection,

It also makes it really tricky to send a useful error to the client, and also to ensure that the connection is closed afterwards.

Moreover, it keeps the flow for this case the same as it is for all other HTTP error cases; the proper client signalling here just falls out of Bandit's design.

@mtrudel mtrudel merged commit d8056ec into main Aug 1, 2024
26 of 28 checks passed
@mtrudel mtrudel deleted the body_timeouts_as_errors branch August 1, 2024 18:42
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.

HTTP1 socket might be overly tolerant of socket timeout error
1 participant