1
0
Fork 0
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:
Philip Wiebe 2014-01-30 13:23:01 -05:00
parent b57a7d7c35
commit ace195c9d4
4 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ pkg
tmp tmp
.rbx/ .rbx/
Gemfile.lock Gemfile.lock
.idea/

View file

@ -267,6 +267,13 @@ module Puma
end end
end end
def write_408
begin
@io << ERROR_408_RESPONSE
rescue StandardError
end
end
def write_500 def write_500
begin begin
@io << ERROR_500_RESPONSE @io << ERROR_500_RESPONSE

View file

@ -59,6 +59,9 @@ module Puma
# The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff. # 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 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 CONTENT_LENGTH = "CONTENT_LENGTH".freeze
# Indicate that there was an internal error, obviously. # Indicate that there was an internal error, obviously.

View file

@ -98,8 +98,9 @@ module Puma
while @timeouts.first.timeout_at < now while @timeouts.first.timeout_at < now
c = @timeouts.shift c = @timeouts.shift
sockets.delete c c.write_408
c.close c.close
sockets.delete c
break if @timeouts.empty? break if @timeouts.empty?
end end