about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/unicorn/tee_input.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index fcf4a95..aa1dff3 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -23,6 +23,13 @@ module Unicorn
         @tmp.write(@buf2)
         @tmp.seek(0)
       end
+
+      # give our socket object a readpartial if it can't handle it
+      if socket && ! socket.respond_to?(:readpartial)
+        def socket.readpartial(nr, buf = Unicorn::Z.dup)
+          buf.replace(read)
+        end
+      end
     end
 
     # returns the size of the input.  This is what the Content-Length