about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-06-29 21:24:59 -0700
committerEric Wong <normalperson@yhbt.net>2009-06-29 21:24:59 -0700
commit7e36e29a69c4adb777e82a91a381bd680967c055 (patch)
treeb659929812b9db47ef9a2e044b76de7ece82351c
parent516c4a8686911a3b6c5e1837d183cd6f515e877c (diff)
downloadunicorn-7e36e29a69c4adb777e82a91a381bd680967c055.tar.gz
Under slow/inconsistent network conditions or overly aggressive
clients, there is a possibility we could've already started
reading the body.  In those cases, don't bother responding
to the expectation to continue since the client has already
started sending a message body.
-rw-r--r--lib/unicorn/http_request.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 553c3df..d2fdac8 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -88,10 +88,10 @@ module Unicorn
     # Handles dealing with the rest of the request
     # returns a Rack environment if successful
     def handle_body(socket)
-      if /\A100-continue\z/i =~ PARAMS[Const::HTTP_EXPECT]
-        socket.write(Const::EXPECT_100_RESPONSE)
-      end
       PARAMS[Const::RACK_INPUT] = if (body = PARAMS.delete(:http_body))
+        if 0 == body.size && /\A100-continue\z/i =~ PARAMS[Const::HTTP_EXPECT]
+          socket.write(Const::EXPECT_100_RESPONSE)
+        end
         length = PARAMS[Const::CONTENT_LENGTH].to_i
 
         if te = PARAMS[Const::HTTP_TRANSFER_ENCODING]