mirror of https://github.com/rails/rails
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
This commit is contained in:
parent
3e7d191e64
commit
94921293db
|
@ -1,7 +1,11 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added proper handling of HEAD requests, so that content isn't returned (Request#head? added as well) #277 [Eric Hodel]
|
||||||
|
|
||||||
|
* Added indifference to whether @headers["Content-Type"], @headers["Content-type"], or @headers["content-type"] is used.
|
||||||
|
|
||||||
* Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
|
* Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
|
||||||
cookie-based sessions [jcf]
|
cookie-based sessions #275 [jcf]
|
||||||
|
|
||||||
* Fixed that cached template loading would still check the file system to see if the file existed #258 [Andreas Schwarz]
|
* Fixed that cached template loading would still check the file system to see if the file existed #258 [Andreas Schwarz]
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,10 @@ module ActionController #:nodoc:
|
||||||
$stdout.binmode if $stdout.respond_to?(:binmode)
|
$stdout.binmode if $stdout.respond_to?(:binmode)
|
||||||
$stdout.sync = false
|
$stdout.sync = false
|
||||||
print @cgi.header(@headers)
|
print @cgi.header(@headers)
|
||||||
if @body.respond_to?(:call)
|
|
||||||
|
if @cgi.head?
|
||||||
|
return
|
||||||
|
elsif @body.respond_to?(:call)
|
||||||
@body.call(self)
|
@body.call(self)
|
||||||
else
|
else
|
||||||
print @body
|
print @body
|
||||||
|
@ -116,9 +119,11 @@ module ActionController #:nodoc:
|
||||||
|
|
||||||
private
|
private
|
||||||
def convert_content_type!(headers)
|
def convert_content_type!(headers)
|
||||||
if headers["Content-Type"]
|
%w( Content-Type Content-type content-type ).each do |ct|
|
||||||
headers["type"] = headers["Content-Type"]
|
if headers[ct]
|
||||||
headers.delete "Content-Type"
|
headers["type"] = headers[ct]
|
||||||
|
headers.delete(ct)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,10 @@ module ActionController
|
||||||
method == :delete
|
method == :delete
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def head?
|
||||||
|
method == :head
|
||||||
|
end
|
||||||
|
|
||||||
# Determine originating IP address. REMOTE_ADDR is the standard
|
# Determine originating IP address. REMOTE_ADDR is the standard
|
||||||
# but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or
|
# 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
|
# HTTP_X_FORWARDED_FOR are set by proxies so check for these before
|
||||||
|
|
Loading…
Reference in New Issue