about summary refs log tree commit homepage
path: root/lib/unicorn/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-01-22 11:04:52 +0000
committerEric Wong <normalperson@yhbt.net>2013-01-22 11:43:06 +0000
commit705cf5fcf8ccb37deef5d2b922d6d78d34765c5b (patch)
tree19b250d132aa1c4f9a50b59d1096cf4ce8a34122 /lib/unicorn/http_server.rb
parentfaf1edc74c9bb35cf4e131d794c1923bf124aa1c (diff)
downloadunicorn-705cf5fcf8ccb37deef5d2b922d6d78d34765c5b.tar.gz
Rack 1.5.0 (protocol version [1,2]) adds support for
hijacking the client socket (removing it from the control
of unicorn (or any other Rack webserver)).

Tested with rack 1.5.0.
Diffstat (limited to 'lib/unicorn/http_server.rb')
-rw-r--r--lib/unicorn/http_server.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index aa98aeb..2d8e4e1 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -559,8 +559,10 @@ class Unicorn::HttpServer
     @request.headers? or headers = nil
     http_response_write(client, status, headers, body,
                         @request.response_start_sent)
-    client.shutdown # in case of fork() in Rack app
-    client.close # flush and uncork socket immediately, no keepalive
+    unless client.closed? # rack.hijack may've close this for us
+      client.shutdown # in case of fork() in Rack app
+      client.close # flush and uncork socket immediately, no keepalive
+    end
   rescue => e
     handle_error(client, e)
   end