diff options
Diffstat (limited to 'lib/kcar/response.rb')
-rw-r--r-- | lib/kcar/response.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/kcar/response.rb b/lib/kcar/response.rb index dba84e6..f34971d 100644 --- a/lib/kcar/response.rb +++ b/lib/kcar/response.rb @@ -63,21 +63,14 @@ class Kcar::Response # body. It may only be called once (usually by a Rack server) as it streams # the response body off the our socket object. def each - if @parser.body_eof? - return - end + return if @parser.body_eof? if @unchunk @parser.chunked? ? each_unchunk { |x| yield x } : each_identity { |x| yield x } else - if @parser.keepalive? - @parser.chunked? ? each_rechunk { |x| yield x } : - each_identity { |x| yield x } - else - each_until_eof { |x| yield x } # fastest path - end + @parser.chunked? ? each_rechunk { |x| yield x } : + each_identity { |x| yield x } end - rescue EOFError end # :stopdoc: @@ -123,6 +116,7 @@ class Kcar::Response begin yield dst end while @sock.readpartial(READ_SIZE, dst) + rescue EOFError end def each_identity |