diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-11 22:09:03 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-11 22:11:26 -0800 |
commit | 4d5a366f386e0f8a0b667e3071a6c027ae560fdd (patch) | |
tree | 3e638f6594e249dd03569cfda1404262e90fca2e | |
parent | 0f68fbf889568ee38828301f403b7284bac2b63a (diff) | |
download | rainbows-4d5a366f386e0f8a0b667e3071a6c027ae560fdd.tar.gz |
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.
-rw-r--r-- | lib/rainbows/revactor/tee_input.rb | 17 |
1 files changed, 7 insertions, 10 deletions
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 |