diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 13 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 4 |
2 files changed, 13 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 diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index d58cf58543..9eb0b04ef0 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -26,6 +26,10 @@ module ActionController method == :delete end + def head? + method == :head + end + # Determine originating IP address. REMOTE_ADDR is the standard # but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or # HTTP_X_FORWARDED_FOR are set by proxies so check for these before |