From 991189b58d605f938200e8df1ef6e65583345067 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 20 Nov 2005 05:31:33 +0000 Subject: Document request.env and request.host. Strip trailing whitespace. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3103 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/request.rb | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index a61788237c..57b7eea366 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -2,7 +2,7 @@ module ActionController # These methods are available in both the production and test Request objects. class AbstractRequest cattr_accessor :relative_url_root - + # Returns both GET and POST parameters in a single hash. def parameters @parameters ||= request_parameters.merge(query_parameters).merge(path_parameters).with_indifferent_access @@ -110,7 +110,7 @@ module ActionController # a different tld_length, such as 2 to catch rubyonrails.co.uk in "www.rubyonrails.co.uk". def domain(tld_length = 1) return nil if !/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.match(host).nil? or host.nil? - + host.split('.').last(1 + tld_length).join('.') end @@ -123,13 +123,13 @@ module ActionController parts[0..-(tld_length+2)] end - # Receive the raw post data. - # This is useful for services such as REST, XMLRPC and SOAP - # which communicate over HTTP POST but don't use the traditional parameter format. + # Receive the raw post data. + # This is useful for services such as REST, XMLRPC and SOAP + # which communicate over HTTP POST but don't use the traditional parameter format. def raw_post env['RAW_POST_DATA'] end - + # Returns the request URI correctly, taking into account the idiosyncracies # of the various servers. def request_uri @@ -153,9 +153,9 @@ module ActionController # Is this an SSL request? def ssl? - env['HTTPS'] == 'on' + env['HTTPS'] == 'on' end - + # Returns the interpreted path to requested resource after all the installation directory of this application was taken into account def path path = (uri = request_uri) ? uri.split('?').first : '' @@ -165,7 +165,7 @@ module ActionController path[0, root.length] = '' if root path || '' end - + # Returns the path minus the web server relative installation directory. # This method returns nil unless the web server is apache. def relative_url_root @@ -176,7 +176,7 @@ module ActionController def port @port_as_int ||= env['SERVER_PORT'].to_i end - + # Returns the standard port number for this request's protocol def standard_port case protocol @@ -196,12 +196,12 @@ module ActionController def host_with_port host + port_string end - + def path_parameters=(parameters) @path_parameters = parameters @symbolized_path_parameters = @parameters = nil end - + def symbolized_path_parameters @symbolized_path_parameters ||= path_parameters.symbolize_keys end @@ -224,10 +224,13 @@ module ActionController def request_parameters #:nodoc: end - def env #:nodoc: + # Returns the hash of environment variables for this request, + # such as { 'RAILS_ENV' => 'production' }. + def env end - def host #:nodoc: + # Returns the host for this request, such as example.com. + def host end def cookies #:nodoc: @@ -237,6 +240,6 @@ module ActionController end def reset_session #:nodoc: - end + end end end -- cgit v1.2.3