about summary refs log tree commit homepage
path: root/lib/unicorn/http_request.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-05 23:34:39 +0000
committerEric Wong <normalperson@yhbt.net>2010-10-05 23:37:44 +0000
commitd4c898a4adc6cb6c3a20a648ae6b9b6a226066a6 (patch)
tree6c38ba546dce2ecdca0d54cf87d4396fedcd6ad6 /lib/unicorn/http_request.rb
parent80f9987581014d694b8eb67bba0d5c408b7d0f98 (diff)
downloadunicorn-d4c898a4adc6cb6c3a20a648ae6b9b6a226066a6.tar.gz
This provides the kgio_read! method which is like readpartial,
only significantly cheaper when a client disconnects on us.
Diffstat (limited to 'lib/unicorn/http_request.rb')
-rw-r--r--lib/unicorn/http_request.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 7519170..13e9900 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -64,11 +64,11 @@ class Unicorn::HttpRequest
     @env[REMOTE_ADDR] = socket.kgio_addr
 
     # short circuit the common case with small GET requests first
-    if @parser.headers(@env, socket.readpartial(16384, @buf)).nil?
+    if @parser.headers(@env, socket.kgio_read!(16384, @buf)).nil?
       # Parser is not done, queue up more data to read and continue parsing
       # an Exception thrown from the PARSER will throw us out of the loop
       begin
-        @buf << socket.readpartial(16384)
+        @buf << socket.kgio_read!(16384)
       end while @parser.headers(@env, @buf).nil?
     end
     @env[RACK_INPUT] = 0 == @parser.content_length ?