about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 11:41:36 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-05 11:42:49 -0800
commitbd397ee11b60243ef15c5558c4309e46e27e6192 (patch)
tree326b81e5d86f42f1905b3c9f22ec3e0a582f9870 /lib
parent062227e00f7ec589c3906a8bcd22dd7194268266 (diff)
downloadunicorn-bd397ee11b60243ef15c5558c4309e46e27e6192.tar.gz
No need to preserve the response tuplet if we're just
going to unpack it eventually.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn/http_response.rb5
-rw-r--r--lib/unicorn/http_server.rb11
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index c59ce2c..3a03cd6 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -3,7 +3,7 @@
 # You use it by simply doing:
 #
 #   status, headers, body = rack_app.call(env)
-#   http_response_write(socket, [ status, headers, body ])
+#   http_response_write(socket, status, headers, body)
 #
 # Most header correctness (including Content-Length and Content-Type)
 # is the job of Rack, with the exception of the "Date" and "Status" header.
@@ -17,8 +17,7 @@ module Unicorn::HttpResponse
   CRLF = "\r\n"
 
   # writes the rack_response to socket as an HTTP response
-  def http_response_write(socket, rack_response)
-    status, headers, body = rack_response
+  def http_response_write(socket, status, headers, body)
     status = CODES[status.to_i] || status
 
     if headers
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index fbc9a68..e2a4db7 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -529,16 +529,15 @@ class Unicorn::HttpServer
   # once a client is accepted, it is processed in its entirety here
   # in 3 easy steps: read request, call app, write app response
   def process_client(client)
-    r = @app.call(env = @request.read(client))
+    status, headers, body = @app.call(env = @request.read(client))
 
-    if 100 == r[0].to_i
+    if 100 == status.to_i
       client.write(Unicorn::Const::EXPECT_100_RESPONSE)
       env.delete(Unicorn::Const::HTTP_EXPECT)
-      r = @app.call(env)
+      status, headers, body = @app.call(env)
     end
-    # r may be frozen or const, so don't modify it
-    @request.headers? or r = [ r[0], nil, r[2] ]
-    http_response_write(client, r)
+    @request.headers? or headers = nil
+    http_response_write(client, status, headers, body)
   rescue => e
     handle_error(client, e)
   end