about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 22:39:03 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-05 22:58:18 -0800
commitb72a86f66c722d56a6d77ed1d2779ace6ad103ed (patch)
treec074232094580831bd110f1dcce528fd69cdcd63 /lib
parent1b69686fd28347eb5c071a9b76e2939bca424f04 (diff)
downloadunicorn-b72a86f66c722d56a6d77ed1d2779ace6ad103ed.tar.gz
Response bodies may capture the block passed to each
and save it for body.close, so don't close the socket
before we have a chance to call body.close
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn/http_response.rb1
-rw-r--r--lib/unicorn/http_server.rb1
2 files changed, 1 insertions, 1 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 3a03cd6..62b3ee9 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -38,7 +38,6 @@ module Unicorn::HttpResponse
     end
 
     body.each { |chunk| socket.write(chunk) }
-    socket.close # flushes and uncorks the socket immediately
     ensure
       body.respond_to?(:close) and body.close
   end
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index e2a4db7..3a6e51e 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -538,6 +538,7 @@ class Unicorn::HttpServer
     end
     @request.headers? or headers = nil
     http_response_write(client, status, headers, body)
+    client.close # flush and uncork socket immediately, no keepalive
   rescue => e
     handle_error(client, e)
   end