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

Fix: Properly complete HTTP response on error #430

Merged
merged 1 commit into from
May 22, 2024

Conversation

YouXam
Copy link
Contributor

@YouXam YouXam commented May 18, 2024

This commit addresses an issue where the EspHttpServer does not handle errors correctly, causing the HTTP connection to hang indefinitely. When an error is returned from a closure handling an HTTP request, the server logs the error but does not complete the response. As a result, the client hangs indefinitely, waiting for the response to be fully sent. This PR adds a call to connection.complete() in the error handling code to ensure that the response is properly finalized.

Fixes: #328

This commit addresses the issue where the EspHttpServer does not handle errors correctly, causing the HTTP connection to hang indefinitely. The issue was due to the lack of a connection.complete() call when an error occurs.

Fixes: esp-rs#328
@ivmarkov
Copy link
Collaborator

Hm, I was under the impression that if we don't do it, the underlying C code does it anyway (i.e. send the response if it is not send yet)?

But since you say it actually doesn't... thanks!

@ivmarkov ivmarkov merged commit 9b64dbc into esp-rs:master May 22, 2024
12 checks passed
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.

http/server.rs: Response blocking when returning HandlerError
2 participants