about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-30 03:07:03 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-30 23:55:47 -0700
commit1bb4366c049a2d1c460cb08601865a24d7678dbe (patch)
tree32412cbefca38e571319cf05f65101d4088e6e0c
parent8f174df6394d562bcc8542ebcd2a9e45c9a927ff (diff)
downloadunicorn-1bb4366c049a2d1c460cb08601865a24d7678dbe.tar.gz
Rack does not like it; instead try to set it as
the @status code if possible.
-rw-r--r--lib/unicorn/cgi_wrapper.rb5
1 files changed, 4 insertions, 1 deletions
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)