about summary refs log tree commit homepage
path: root/lib/unicorn/stream_input.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicorn/stream_input.rb')
-rw-r--r--lib/unicorn/stream_input.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb
index 4ca5a04..c8a4240 100644
--- a/lib/unicorn/stream_input.rb
+++ b/lib/unicorn/stream_input.rb
@@ -139,7 +139,11 @@ private
     # we do support clients that shutdown(SHUT_WR) after the
     # _entire_ request has been sent, and those will not have
     # raised EOFError on us.
-    @socket.close if @socket
+    if @socket
+      @socket.shutdown
+      @socket.close
+    end
+  ensure
     raise Unicorn::ClientShutdown, "bytes_read=#{@bytes_read}", []
   end
 end