socketry / async-http

MIT License
298 stars 45 forks source link

Make fail_request properly finish the response #129

Closed zarqman closed 10 months ago

zarqman commented 10 months ago

Previously fail_request wrote the initial part of the response, but failed to finish it. When tested with Async::HTTP::Client, this caused the client to experience an EOFError.

This PR causes fail_request to now finish the response. It also rescues exceptions that might arise from the attempt to write the response.

Before:

HTTP/1.1 400 Bad Request

After:

HTTP/1.1 400 Bad Request
connection: close
content-length: 0
                  <- required final blank line

Types of Changes

Contribution