diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-09 11:15:38 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-09 11:47:44 -0600 |
commit | e1f73aab8ca679a68a32bec6c0d72eb8a58d8788 (patch) | |
tree | e097c9c5dfc6dc6426c13a20bc911803f7da4caf /actionpack/lib/action_controller/request.rb | |
parent | e0fa041fce963744eaa4ef98a55d90ed895a6a00 (diff) | |
download | rails-e1f73aab8ca679a68a32bec6c0d72eb8a58d8788.tar.gz rails-e1f73aab8ca679a68a32bec6c0d72eb8a58d8788.tar.bz2 rails-e1f73aab8ca679a68a32bec6c0d72eb8a58d8788.zip |
Inherit ActionController::Request from Rack::Request
Diffstat (limited to 'actionpack/lib/action_controller/request.rb')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 6ac8c6f4a0..29d06441e4 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -6,25 +6,17 @@ require 'active_support/memoizable' require 'action_controller/cgi_ext' module ActionController - # CgiRequest and TestRequest provide concrete implementations. - class Request + class Request < Rack::Request extend ActiveSupport::Memoizable - class SessionFixationAttempt < StandardError #:nodoc: - end - - # The hash of environment variables for this request, - # such as { 'RAILS_ENV' => 'production' }. - attr_reader :env - def initialize(env) - @env = env + super @parser = ActionController::RequestParser.new(env) end - %w[ AUTH_TYPE GATEWAY_INTERFACE PATH_INFO + %w[ AUTH_TYPE GATEWAY_INTERFACE PATH_TRANSLATED REMOTE_HOST - REMOTE_IDENT REMOTE_USER SCRIPT_NAME + REMOTE_IDENT REMOTE_USER REMOTE_ADDR SERVER_NAME SERVER_PROTOCOL HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING @@ -45,8 +37,7 @@ module ActionController # The true HTTP request \method as a lowercase symbol, such as <tt>:get</tt>. # UnknownHttpMethod is raised for invalid methods not listed in ACCEPTED_HTTP_METHODS. def request_method - method = @env['REQUEST_METHOD'] - HTTP_METHOD_LOOKUP[method] || raise(UnknownHttpMethod, "#{method}, accepted HTTP methods are #{HTTP_METHODS.to_sentence}") + HTTP_METHOD_LOOKUP[super] || raise(UnknownHttpMethod, "#{super}, accepted HTTP methods are #{HTTP_METHODS.to_sentence}") end memoize :request_method @@ -93,7 +84,7 @@ module ActionController # Returns the content length of the request as an integer. def content_length - @env["action_controller.request.content_length"] ||= @env['CONTENT_LENGTH'].to_i + super.to_i end # The MIME type of the HTTP request, such as Mime::XML. @@ -421,15 +412,6 @@ EOM @parser.body end - def remote_addr - @env['REMOTE_ADDR'] - end - - def referrer - @env['HTTP_REFERER'] - end - alias referer referrer - def query_parameters @parser.query_parameters end @@ -442,10 +424,6 @@ EOM @env['rack.input'] end - def cookies - Rack::Request.new(@env).cookies - end - def session @env['rack.session'] ||= {} end |