method
request_uri
rails latest stable - Class:
ActionController::Request
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.
request_uri()public
Returns the request URI, accounting for server idiosyncrasies. WEBrick includes the full URL. IIS leaves REQUEST_URI blank.
# File actionpack/lib/action_controller/request.rb, line 343
def request_uri
if uri = @env['REQUEST_URI']
# Remove domain, which webrick puts into the request_uri.
(%r{^\w+\://[^/]+(/.*|$)$} =~ uri) ? $1 : uri
else
# Construct IIS missing REQUEST_URI from SCRIPT_NAME and PATH_INFO.
uri = @env['PATH_INFO'].to_s
if script_filename = @env['SCRIPT_NAME'].to_s.match(%r{[^/]+$})
uri = uri.sub(/#{script_filename}\//, '')
end
env_qs = @env['QUERY_STRING'].to_s
uri += "?#{env_qs}" unless env_qs.empty?
if uri.blank?
@env.delete('REQUEST_URI')
else
@env['REQUEST_URI'] = uri
end
end
end Related methods
- Instance methods
- GET
- POST
- accepts
- body
- body_stream
- cache_format
- content_length
- content_type
- delete?
- domain
- etag_matches?
- form_data?
- format
- format=
- fresh?
- get?
- head?
- headers
- host
- host_with_port
- if_modified_since
- if_none_match
- key?
- media_type
- method
- not_modified?
- parameters
- params
- path
- path_parameters
- path_parameters=
- port
- port_string
- post?
- protocol
- put?
- query_parameters
- query_string
- raw_host_with_port
- raw_post
- remote_ip
- request_method
- request_parameters
- request_uri
- reset_session
- server_port
- server_software
- session
- session=
- session_options
- session_options=
- ssl?
- standard_port
- subdomains
- symbolized_path_parameters
- template_format
- url
- xhr?
- xml_http_request?
- Private methods
-
named_host? -
normalize_parameters