diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 10:50:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 10:50:26 +0000 |
commit | 94921293dbdbdf7fe49023fe7ed8908e05d3615f (patch) | |
tree | 7c439e1557e9971ab2ea4b64799823be5791ae6c /actionpack/lib/action_controller/cgi_process.rb | |
parent | 3e7d191e6450a3050976c735b0efc11b8a0aee93 (diff) | |
download | rails-94921293dbdbdf7fe49023fe7ed8908e05d3615f.tar.gz rails-94921293dbdbdf7fe49023fe7ed8908e05d3615f.tar.bz2 rails-94921293dbdbdf7fe49023fe7ed8908e05d3615f.zip |
Added indifference to whether @headers["Content-Type"], @headers["Content-type"], or @headers["content-type"] is used. Added proper handling of HEAD requests, so that content isnt returned (Request#head? added as well) #277 [Eric Hodel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@57 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/cgi_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 8610f60854..abc743246f 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -107,7 +107,10 @@ module ActionController #:nodoc: $stdout.binmode if $stdout.respond_to?(:binmode) $stdout.sync = false print @cgi.header(@headers) - if @body.respond_to?(:call) + + if @cgi.head? + return + elsif @body.respond_to?(:call) @body.call(self) else print @body @@ -116,9 +119,11 @@ module ActionController #:nodoc: private def convert_content_type!(headers) - if headers["Content-Type"] - headers["type"] = headers["Content-Type"] - headers.delete "Content-Type" + %w( Content-Type Content-type content-type ).each do |ct| + if headers[ct] + headers["type"] = headers[ct] + headers.delete(ct) + end end end end |