From bd397ee11b60243ef15c5558c4309e46e27e6192 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Jan 2011 11:41:36 -0800 Subject: http_response: simplify the status == 100 comparison No need to preserve the response tuplet if we're just going to unpack it eventually. --- lib/unicorn/http_server.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/unicorn/http_server.rb') 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 -- cgit v1.2.3-24-ge0c7