diff --git a/lib/redis/client.rb b/lib/redis/client.rb index a988af37c..3e620faa9 100644 --- a/lib/redis/client.rb +++ b/lib/redis/client.rb @@ -302,7 +302,7 @@ def io e2 = TimeoutError.new("Connection timed out") e2.set_backtrace(e1.backtrace) raise e2 - rescue Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EBADF, Errno::EINVAL => e + rescue Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EBADF, Errno::EINVAL, EOFError => e raise ConnectionError, "Connection lost (%s)" % [e.class.name.split("::").last] end diff --git a/lib/redis/connection/ruby.rb b/lib/redis/connection/ruby.rb index 81c81616c..f3740453b 100644 --- a/lib/redis/connection/ruby.rb +++ b/lib/redis/connection/ruby.rb @@ -384,6 +384,12 @@ def read format_reply(reply_type, line) rescue Errno::EAGAIN raise TimeoutError + rescue OpenSSL::SSL::SSLError => ssl_error + if ssl_error.message.match?(/SSL_read: unexpected eof while reading/i) + raise EOFError, ssl_error.message + else + raise + end end def format_reply(reply_type, line)