Skip to content

Commit

Permalink
More specific BadRequest error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 26, 2024
1 parent 7dde0bc commit 598bd82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion async-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "io-endpoint", "~> 0.11"
spec.add_dependency "io-stream", "~> 0.4"
spec.add_dependency "protocol-http", "~> 0.28"
spec.add_dependency "protocol-http1", "~> 0.19"
spec.add_dependency "protocol-http1", "~> 0.20"
spec.add_dependency "protocol-http2", "~> 0.18"
spec.add_dependency "traces", ">= 0.10"
end
8 changes: 2 additions & 6 deletions lib/async/http/protocol/http1/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ def next_request
end

return request
rescue Async::TimeoutError, IO::TimeoutError
# For an interesting discussion about this behaviour, see https://trac.nginx.org/nginx/ticket/1005
# If you enable this, you will see some spec failures...
# fail_request(408)
raise
rescue
rescue ::Protocol::HTTP1::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
end

Expand Down

0 comments on commit 598bd82

Please sign in to comment.