about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-11 20:19:40 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-11 22:09:17 -0800
commit7e5942c3de1d79a6597443db5158b74c5253f6d3 (patch)
tree38d9d8e8ce03817a253234fed070c40f5a6ce045
parentb398e1903bac5dd35ed088f73be5abe3b242d009 (diff)
downloadunicorn-7e5942c3de1d79a6597443db5158b74c5253f6d3.tar.gz
Just let the error bubble all the way up to where Unicorn calls
process_client where it'll be appropriately handled.
Additionally, we'l just check the return value of tee() in
ensure_length and avoid it if it nils on us.
-rw-r--r--lib/unicorn/tee_input.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index 4d1ec8c..eeed7ba 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -128,13 +128,10 @@ module Unicorn
     # returns nil if reading from the input returns nil
     def tee(length, dst)
       unless parser.body_eof?
-        begin
-          if parser.filter_body(dst, socket.readpartial(length, buf)).nil?
-            @tmp.write(dst)
-            @tmp.seek(0, IO::SEEK_END) # workaround FreeBSD/OSX + MRI 1.8.x bug
-            return dst
-          end
-        rescue EOFError
+        if parser.filter_body(dst, socket.readpartial(length, buf)).nil?
+          @tmp.write(dst)
+          @tmp.seek(0, IO::SEEK_END) # workaround FreeBSD/OSX + MRI 1.8.x bug
+          return dst
         end
       end
       finalize_input
@@ -159,8 +156,8 @@ module Unicorn
       # block the caller in that case.
       return buf if buf.nil? || @size.nil?
 
-      while buf.size < length && @size != @tmp.pos
-        buf << tee(length - buf.size, @buf2)
+      while buf.size < length && tee(length - buf.size, @buf2)
+        buf << @buf2
       end
 
       buf