From 4d5a366f386e0f8a0b667e3071a6c027ae560fdd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 11 Nov 2009 22:09:03 -0800 Subject: revactor/tee_input: unnecessary error handling We're doomed if the client socket EOFs on us while we're reading it. So don't hide it and let the exception bubble all the way up the stack. --- lib/rainbows/revactor/tee_input.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/rainbows/revactor') diff --git a/lib/rainbows/revactor/tee_input.rb b/lib/rainbows/revactor/tee_input.rb index b8042ad..b34931f 100644 --- a/lib/rainbows/revactor/tee_input.rb +++ b/lib/rainbows/revactor/tee_input.rb @@ -21,17 +21,14 @@ module Rainbows # returns nil if reading from the input returns nil def tee(length, dst) unless parser.body_eof? - begin - if parser.filter_body(dst, buf << socket.read).nil? - @tmp.write(dst) - diff = dst.size - length - if diff > 0 - dst.replace(dst[0,length]) - @tmp.seek(-diff, IO::SEEK_CUR) - end - return dst + if parser.filter_body(dst, buf << socket.read).nil? + @tmp.write(dst) + diff = dst.size - length + if diff > 0 + dst.replace(dst[0,length]) + @tmp.seek(-diff, IO::SEEK_CUR) end - rescue EOFError + return dst end end finalize_input -- cgit v1.2.3-24-ge0c7