From 1bb4366c049a2d1c460cb08601865a24d7678dbe Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 30 Mar 2009 03:07:03 -0700 Subject: cgi_wrapper: ensure "Status:" header is not set Rack does not like it; instead try to set it as the @status code if possible. --- lib/unicorn/cgi_wrapper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/unicorn/cgi_wrapper.rb b/lib/unicorn/cgi_wrapper.rb index 816b0a0..a08c3f1 100644 --- a/lib/unicorn/cgi_wrapper.rb +++ b/lib/unicorn/cgi_wrapper.rb @@ -26,6 +26,7 @@ class Unicorn::CGIWrapper < ::CGI CHARSET = 'charset'.freeze # this gets appended to Content-Type COOKIE = 'cookie'.freeze # maps (Hash,Array,String) to "Set-Cookie" headers STATUS = 'status'.freeze # stored as @status + Status = 'Status'.freeze # fallback, Rails sets this # some of these are common strings, but this is the only module # using them and the reason they're not in Unicorn::Const @@ -63,6 +64,7 @@ class Unicorn::CGIWrapper < ::CGI cookies = @head.delete(:cookies) cookies.empty? or @head[SET_COOKIE] = cookies.join("\n") @head[CONTENT_LENGTH] ||= @body.size + @head.delete(Status) [ @status, @head, [ @body.string ] ] end @@ -97,7 +99,8 @@ class Unicorn::CGIWrapper < ::CGI cookies << cookie.to_s end end - @status ||= (status = options.delete(STATUS)) + @status ||= (status = options.delete(STATUS)) # all lower-case + @status ||= (status = options.delete(Status)) # Capitalized # drop the keys we don't want anymore options.delete(NPH) options.delete(CONNECTION) -- cgit v1.2.3-24-ge0c7