about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/unicorn.rb5
-rw-r--r--lib/unicorn/socket.rb1
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 794786a..bc940f0 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -6,6 +6,7 @@ require 'uri'
 require 'stringio'
 require 'fcntl'
 require 'logger'
+require 'io/nonblock'
 
 # Compiled extension
 require 'http11'
@@ -82,7 +83,7 @@ module Unicorn
         parser, params = @parser, @params
         parser.reset
         params.clear
-        data = client.readpartial(Const::CHUNK_SIZE)
+        data = client.sysread(Const::CHUNK_SIZE)
         nparsed = 0
 
         # Assumption: nparsed will always be less since data will get filled with more
@@ -119,7 +120,7 @@ module Unicorn
           break #done
           else
             # Parser is not done, queue up more data to read and continue parsing
-            chunk = client.readpartial(Const::CHUNK_SIZE)
+            chunk = client.sysread(Const::CHUNK_SIZE)
             break if !chunk or chunk.length == 0  # read failed, stop processing
 
             data << chunk
diff --git a/lib/unicorn/socket.rb b/lib/unicorn/socket.rb
index 1f0f03f..3f567c6 100644
--- a/lib/unicorn/socket.rb
+++ b/lib/unicorn/socket.rb
@@ -28,6 +28,7 @@ class Socket
 
   def unicorn_client_init
     self.sync = true
+    self.nonblock = false
     self.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) if defined?(TCP_NODELAY)
     self.setsockopt(SOL_TCP, TCP_CORK, 1) if defined?(TCP_CORK)
   end