diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-11 08:26:05 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-11 08:26:05 +0000 |
commit | 925f88873fac6541f5521a5dacfc8f1b3a91712c (patch) | |
tree | 9133aac51a8f864939a6c5a767904022008d4eb6 | |
parent | b51edf0e5c563d73f09fd67016014dcfc7e7499a (diff) | |
download | unicorn-925f88873fac6541f5521a5dacfc8f1b3a91712c.tar.gz |
HttpRequest::DEF_PARAMS => HttpRequest::DEFAULTS
Give this a more palatable name and unfreeze it, allowing users to modify it more easily.
-rw-r--r-- | lib/unicorn/http_request.rb | 28 |
1 files 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 |