mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
added 408 status on timeout.
This commit is contained in:
parent
b57a7d7c35
commit
ace195c9d4
4 changed files with 13 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@ pkg
|
|||
tmp
|
||||
.rbx/
|
||||
Gemfile.lock
|
||||
.idea/
|
||||
|
|
|
@ -267,6 +267,13 @@ module Puma
|
|||
end
|
||||
end
|
||||
|
||||
def write_408
|
||||
begin
|
||||
@io << ERROR_408_RESPONSE
|
||||
rescue StandardError
|
||||
end
|
||||
end
|
||||
|
||||
def write_500
|
||||
begin
|
||||
@io << ERROR_500_RESPONSE
|
||||
|
|
|
@ -59,6 +59,9 @@ module Puma
|
|||
# The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
|
||||
ERROR_404_RESPONSE = "HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Puma #{PUMA_VERSION}\r\n\r\nNOT FOUND".freeze
|
||||
|
||||
# The standard empty 408 response for requests that timed out.
|
||||
ERROR_408_RESPONSE = "HTTP/1.1 408 Request Timeout\r\nConnection: close\r\nServer: Puma #{PUMA_VERSION}\r\n\r\n".freeze
|
||||
|
||||
CONTENT_LENGTH = "CONTENT_LENGTH".freeze
|
||||
|
||||
# Indicate that there was an internal error, obviously.
|
||||
|
|
|
@ -98,8 +98,9 @@ module Puma
|
|||
|
||||
while @timeouts.first.timeout_at < now
|
||||
c = @timeouts.shift
|
||||
sockets.delete c
|
||||
c.write_408
|
||||
c.close
|
||||
sockets.delete c
|
||||
|
||||
break if @timeouts.empty?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue