1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Handle all read exceptions properly. Fixes #252

This commit is contained in:
Evan Phoenix 2013-06-01 14:20:45 -07:00
parent e3f1009074
commit dcf96b79a6
2 changed files with 8 additions and 1 deletions

View file

@ -16,6 +16,9 @@ if Puma::IS_JRUBY
end
module Puma
class ConnectionError < RuntimeError; end
class Client
include Puma::Const
@ -139,6 +142,8 @@ module Puma
data = @io.read_nonblock(CHUNK_SIZE)
rescue Errno::EAGAIN
return false
rescue SystemCallError, IOError
raise ConnectionError, "Connection error detected during read"
end
if @buffer
@ -223,6 +228,8 @@ module Puma
chunk = @io.read_nonblock(want)
rescue Errno::EAGAIN
return false
rescue SystemCallError, IOError
raise ConnectionError, "Connection error detected during read"
end
# No chunk means a closed socket

View file

@ -135,7 +135,7 @@ module Puma
client.close
@events.parse_error self, client.env, e
rescue IOError
rescue ConnectionError
client.close
else
if process_now