mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Send 408 request timeout even when queue requests is disabled (#2119)
This commit is contained in:
parent
afb27d5552
commit
4f8a85f421
4 changed files with 12 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
|||
* Your bugfix goes here (#Github Number)
|
||||
* Windows update extconf.rb for use with ssp and varied Ruby/MSYS2 combinations (#2069)
|
||||
* Preserve `BUNDLE_GEMFILE` env var when using `prune_bundler` (#1893)
|
||||
* Send 408 request timeout even when queue requests is disabled (#2119)
|
||||
|
||||
* Refactor
|
||||
* Remove unused loader argument from Plugin initializer (#2095)
|
||||
|
|
|
@ -243,10 +243,13 @@ module Puma
|
|||
send(:alias_method, :jruby_eagerly_finish, :eagerly_finish)
|
||||
end # IS_JRUBY
|
||||
|
||||
def finish
|
||||
def finish(timeout)
|
||||
return true if @ready
|
||||
until try_to_finish
|
||||
IO.select([@to_io], nil, nil)
|
||||
unless IO.select([@to_io], nil, nil, timeout)
|
||||
write_error(408) if in_data_phase
|
||||
raise ConnectionError
|
||||
end
|
||||
end
|
||||
true
|
||||
end
|
||||
|
|
|
@ -308,7 +308,7 @@ module Puma
|
|||
if queue_requests
|
||||
process_now = client.eagerly_finish
|
||||
else
|
||||
client.finish
|
||||
client.finish(@first_data_timeout)
|
||||
process_now = true
|
||||
end
|
||||
rescue MiniSSL::SSLError => e
|
||||
|
|
|
@ -336,6 +336,11 @@ EOF
|
|||
assert_equal "HTTP/1.1 408 Request Timeout\r\n", data
|
||||
end
|
||||
|
||||
def test_timeout_data_no_queue
|
||||
@server = Puma::Server.new @app, @events, queue_requests: false
|
||||
test_timeout_in_data_phase
|
||||
end
|
||||
|
||||
def test_http_11_keep_alive_with_body
|
||||
server_run app: ->(env) { [200, {"Content-Type" => "plain/text"}, ["hello\n"]] }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue