From d385bc4f3ed7b783b7414f5d34299bd2bf242fe6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 21 Jan 2011 04:01:01 +0000 Subject: exec_cgi: handle Status header in CGI response We no longer blindly return 200 if the CGI returned another error code. We also don't want two Status headers in our output since we no longer filter it out. (cherry picked from commit 6cca8e61c66c1c2a8ebe260813fa83e44530a768) --- lib/unicorn/app/exec_cgi.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb index 412c1d9..ff5f53a 100644 --- a/lib/unicorn/app/exec_cgi.rb +++ b/lib/unicorn/app/exec_cgi.rb @@ -113,8 +113,9 @@ module Unicorn::App when /^[ \t]/ then headers[prev] << "\n#{line}" if prev end end + status = headers.delete("Status") || 200 headers['Content-Length'] = size.to_s - [ 200, headers, out ] + [ status, headers, out ] end # ensures rack.input is a file handle that we can redirect stdin to -- cgit v1.2.3-24-ge0c7