0
@@ -22,7 +22,7 @@ module ActionController
0
# such as { 'RAILS_ENV' => 'production' }.
0
- # The true HTTP request
method as a lowercase symbol, such as <tt>:get</tt>.
0
+ # The true HTTP request
\method as a lowercase symbol, such as <tt>:get</tt>.
0
# UnknownHttpMethod is raised for invalid methods not listed in ACCEPTED_HTTP_METHODS.
0
method = @env['REQUEST_METHOD']
0
@@ -32,7 +32,7 @@ module ActionController
0
memoize :request_method
0
- # The HTTP request
method as a lowercase symbol, such as <tt>:get</tt>.
0
+ # The HTTP request
\method as a lowercase symbol, such as <tt>:get</tt>.
0
# Note, HEAD is returned as <tt>:get</tt> since the two are functionally
0
# equivalent from the application's perspective.
0
@@ -59,19 +59,21 @@ module ActionController
0
request_method == :delete
0
- # Is this a HEAD request? <tt>request.method</tt> sees HEAD as <tt>:get</tt>,
0
- # so check the HTTP method directly.
0
+ # Is this a HEAD request? Since <tt>request.method</tt> sees HEAD as <tt>:get</tt>,
0
+ # this \method checks the actual HTTP \method directly.
0
request_method == :head
0
# Provides access to the request's HTTP headers, for example:
0
- # request.headers["Content-Type"] # => "text/plain"
0
+ # request.headers["Content-Type"] # => "text/plain"
0
ActionController::Http::Headers.new(@env)
0
+ # Returns the content length of the request as an integer.
0
@env['CONTENT_LENGTH'].to_i
0
@@ -79,14 +81,14 @@ module ActionController
0
# The MIME type of the HTTP request, such as Mime::XML.
0
- # For backward compatibility, the post
format is extracted from the
0
+ # For backward compatibility, the post
\format is extracted from the
0
# X-Post-Data-Format HTTP header if present.
0
Mime::Type.lookup(content_type_without_parameters)
0
- # Returns the accepted MIME type for the request
0
+ # Returns the accepted MIME type for the request
.0
header = @env['HTTP_ACCEPT'].to_s.strip
0
@@ -123,7 +125,7 @@ module ActionController
0
not_modified?(response.last_modified) || etag_matches?(response.etag)
0
- # Returns the Mime type for the
format used in the request.
0
+ # Returns the Mime type for the
\format used in the request.
0
# GET /posts/5.xml | request.format => Mime::XML
0
# GET /posts/5.xhtml | request.format => Mime::HTML
0
@@ -142,8 +144,8 @@ module ActionController
0
- # Sets the format by string extension, which can be used to force custom formats that are not controlled by the extension.
0
+ # Sets the \format by string extension, which can be used to force custom formats
0
+ # that are not controlled by the extension.
0
# class ApplicationController < ActionController::Base
0
# before_filter :adjust_format_for_iphone
0
@@ -159,7 +161,7 @@ module ActionController
0
# Returns a symbolized version of the <tt>:format</tt> parameter of the request.
0
- # If no
format is given it returns <tt>:js</tt>for AJAX requests and <tt>:html</tt>
0
+ # If no
\format is given it returns <tt>:js</tt>for Ajax requests and <tt>:html</tt>
0
parameter_format = parameters[:format]
0
@@ -190,7 +192,7 @@ module ActionController
0
# the right-hand-side of X-Forwarded-For
0
TRUSTED_PROXIES = /^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i
0
- # Determine
originating IP address. REMOTE_ADDR is the standard
0
+ # Determine
s originating IP address. REMOTE_ADDR is the standard
0
# but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or
0
# HTTP_X_FORWARDED_FOR are set by proxies so check for these if
0
# REMOTE_ADDR is a proxy. HTTP_X_FORWARDED_FOR may be a comma-
0
@@ -237,13 +239,13 @@ EOM
0
memoize :server_software
0
- # Returns the complete URL used for this request
0
+ # Returns the complete URL used for this request
.0
protocol + host_with_port + request_uri
0
- # Return
'https://' if this is an SSL request and 'http://' otherwise.
0
+ # Return
s 'https://' if this is an SSL request and 'http://' otherwise.
0
ssl? ? 'https://' : 'http://'
0
@env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
0
+ # Returns the \host for this request, such as "example.com".
0
if forwarded = env["HTTP_X_FORWARDED_HOST"]
0
forwarded.split(/,\s?/).last
0
- # Returns a host:port string for this request, such as example.com or
0
+ # Returns a \host:\port string for this request, such as "example.com" or
0
"#{host}#{port_string}"
0
- # Returns the standard
port number for this request's protocol0
+ # Returns the standard
\port number for this request's protocol.0
when 'https://' then 443
0
@@ -293,13 +296,13 @@ EOM
0
- # Returns a port suffix like ":8080" if the port number of this request
0
- # is not the default HTTP port 80 or HTTPS port 443.
0
+ # Returns a \port suffix like ":8080" if the \port number of this request
0
+ # is not the default HTTP \port 80 or HTTPS \port 443.
0
port == standard_port ? '' : ":#{port}"
0
- # Returns the
domain part of a host, such as rubyonrails.org in "www.rubyonrails.org". You can specify
0
+ # Returns the
\domain part of a \host, such as "rubyonrails.org" in "www.rubyonrails.org". You can specify
0
# a different <tt>tld_length</tt>, such as 2 to catch rubyonrails.co.uk in "www.rubyonrails.co.uk".
0
def domain(tld_length = 1)
0
return nil unless named_host?(host)
0
host.split('.').last(1 + tld_length).join('.')
0
- # Returns all the subdomains as an array, so ["dev", "www"] would be returned for "dev.www.rubyonrails.org".
0
- # You can specify a different <tt>tld_length</tt>, such as 2 to catch ["www"] instead of ["www", "rubyonrails"]
0
+ # Returns all the \subdomains as an array, so <tt>["dev", "www"]</tt> would be
0
+ # returned for "dev.www.rubyonrails.org". You can specify a different <tt>tld_length</tt>,
0
+ # such as 2 to catch <tt>["www"]</tt> instead of <tt>["www", "rubyonrails"]</tt>
0
# in "www.rubyonrails.co.uk".
0
def subdomains(tld_length = 1)
0
return [] unless named_host?(host)
0
parts[0..-(tld_length+2)]
0
- # Return
the query string, accounting for server idiosyncrasies.
0
+ # Return
s the query string, accounting for server idiosyncrasies.
0
if uri = @env['REQUEST_URI']
0
uri.split('?', 2)[1] || ''
0
- # Return
the request URI, accounting for server idiosyncrasies.
0
+ # Return
s the request URI, accounting for server idiosyncrasies.
0
# WEBrick includes the full URL. IIS leaves REQUEST_URI blank.
0
if uri = @env['REQUEST_URI']
0
- # Returns the interpreted path to requested resource after all the installation directory of this application was taken into account
0
+ # Returns the interpreted \path to requested resource after all the installation
0
+ # directory of this application was taken into account.
0
path = (uri = request_uri) ? uri.split('?').first.to_s : ''
0
- # Read the request
body. This is useful for web services that need to
0
+ # Read the request
\body. This is useful for web services that need to
0
# work with raw requests directly.
0
unless env.include? 'RAW_POST_DATA'
0
- # Returns both GET and POST
parameters in a single hash.
0
+ # Returns both GET and POST
\parameters in a single hash.
0
@parameters ||= request_parameters.merge(query_parameters).update(path_parameters).with_indifferent_access
0
@@ -382,17 +387,17 @@ EOM
0
@symbolized_path_parameters = @parameters = nil
0
- # The same as <tt>path_parameters</tt> with explicitly symbolized keys
0
+ # The same as <tt>path_parameters</tt> with explicitly symbolized keys
.0
def symbolized_path_parameters
0
@symbolized_path_parameters ||= path_parameters.symbolize_keys
0
- # Returns a hash with the parameters used to form the path of the request.
0
- # Returned hash keys are strings. See <tt>symbolized_path_parameters</tt> for symbolized keys.
0
+ # Returns a hash with the \parameters used to form the \path of the request.
0
+ # Returned hash keys are strings:
0
# {'action' => 'my_action', 'controller' => 'my_controller'}
0
+ # See <tt>symbolized_path_parameters</tt> for symbolized keys.
0
@path_parameters ||= {}