diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-12 20:48:46 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-13 17:42:08 +0000 |
commit | 36d02e26fc627fe431bfedc740b80dde75665987 (patch) | |
tree | e2e43fbaab8dc23785b81d0aed0f79faac6685ce /lib/unicorn/http_response.rb | |
parent | f3235420ebd2def1cdcb7c5bbe036f157835420d (diff) | |
download | unicorn-36d02e26fc627fe431bfedc740b80dde75665987.tar.gz |
Preventing needless duplication since Rack already has these codes for us. Also, put the status codes in HttpResponse since nothing else needs (or should need) them.
Diffstat (limited to 'lib/unicorn/http_response.rb')
-rw-r--r-- | lib/unicorn/http_response.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index a9b5f2b..ce04a0d 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -21,6 +21,12 @@ module Unicorn class HttpResponse + # Every standard HTTP code mapped to the appropriate message. + CODES = Rack::Utils::HTTP_STATUS_CODES.inject({}) { |hash,(code,msg)| + hash[code] = "#{code} #{msg}" + hash + } + # Rack does not set/require a Date: header. We always override the # Connection: and Date: headers no matter what (if anything) our # Rack application sent us. @@ -31,7 +37,7 @@ module Unicorn # writes the rack_response to socket as an HTTP response def self.write(socket, rack_response) status, headers, body = rack_response - status = HTTP_STATUS_CODES[status] + status = CODES[status] OUT.clear # Don't bother enforcing duplicate supression, it's a Hash most of |