Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion async-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "io-stream", "~> 0.6"
spec.add_dependency "metrics", "~> 0.12"
spec.add_dependency "protocol-http", "~> 0.58"
spec.add_dependency "protocol-http1", "~> 0.36"
spec.add_dependency "protocol-http1", "~> 0.37"
spec.add_dependency "protocol-http2", "~> 0.22"
spec.add_dependency "protocol-url", "~> 0.2"
spec.add_dependency "traces", "~> 0.10"
Expand Down
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http1/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def next_request
end

return request
rescue ::Protocol::HTTP1::BadRequest
rescue ::Protocol::HTTP::BadRequest
fail_request(400)
# Conceivably we could retry here, but we don't really know how bad the error is, so it's better to just fail:
raise
Expand Down
2 changes: 2 additions & 0 deletions lib/async/http/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def accept(peer, address, task: Task.current)
# If this returns nil, we assume that the connection has been hijacked.
self.call(request)
end
rescue Protocol::HTTP::BadRequest
# Ignore bad requests, just close the connection.
ensure
connection&.close
end
Expand Down
2 changes: 2 additions & 0 deletions releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Unreleased

- Fix `defer_stop` usage in `HTTP1::Server`, improving server graceful shutdown behavior.
- Use more generic `Protocol::HTTP::BadRequest` exception in `HTTP1::Server` to handle bad requests, improving handling of more generic bad request errors.
- Ignore `Protocol::HTTP::BadRequest` exceptions for the purpose of logging, to reduce noise from "expected" bad requests.

## v0.94.0

Expand Down
Loading