From 925f88873fac6541f5521a5dacfc8f1b3a91712c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 11 May 2009 08:26:05 +0000 Subject: HttpRequest::DEF_PARAMS => HttpRequest::DEFAULTS Give this a more palatable name and unfreeze it, allowing users to modify it more easily. --- lib/unicorn/http_request.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 29503f5..368305f 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -12,18 +12,18 @@ module Unicorn # class HttpRequest - # default parameters we merge into the request env for Rack handlers - DEF_PARAMS = { - "rack.errors" => $stderr, - "rack.multiprocess" => true, - "rack.multithread" => false, - "rack.run_once" => false, - "rack.version" => [1, 0].freeze, - "SCRIPT_NAME" => "".freeze, - - # this is not in the Rack spec, but some apps may rely on it - "SERVER_SOFTWARE" => "Unicorn #{Const::UNICORN_VERSION}".freeze - }.freeze + # default parameters we merge into the request env for Rack handlers + DEFAULTS = { + "rack.errors" => $stderr, + "rack.multiprocess" => true, + "rack.multithread" => false, + "rack.run_once" => false, + "rack.version" => [1, 0].freeze, + "SCRIPT_NAME" => "".freeze, + + # this is not in the Rack spec, but some apps may rely on it + "SERVER_SOFTWARE" => "Unicorn #{Const::UNICORN_VERSION}".freeze + } # Optimize for the common case where there's no request body # (GET/HEAD) requests. @@ -103,7 +103,7 @@ module Unicorn if content_length == 0 # short circuit the common case PARAMS[Const::RACK_INPUT] = NULL_IO.closed? ? NULL_IO.reopen : NULL_IO - return PARAMS.update(DEF_PARAMS) + return PARAMS.update(DEFAULTS) end # must read more data to complete body @@ -125,7 +125,7 @@ module Unicorn # another request, we'll truncate it. Again, we don't do pipelining # or keepalive body.truncate(content_length) - PARAMS.update(DEF_PARAMS) + PARAMS.update(DEFAULTS) end # Does the heavy lifting of properly reading the larger body -- cgit v1.2.3-24-ge0c7