aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-01-05 01:10:55 -0800
committerYehuda Katz <wycats@gmail.com>2009-01-05 01:10:55 -0800
commitdb619c4a4115d5eeca9473f8f77f34c877e4e1dd (patch)
tree18c86d54f27884f5f03db0eba86665d4563cfa7e /actionpack/lib/action_controller
parentca54cc5df72a8bd7660d5be8333dcee2b6949257 (diff)
downloadrails-db619c4a4115d5eeca9473f8f77f34c877e4e1dd.tar.gz
rails-db619c4a4115d5eeca9473f8f77f34c877e4e1dd.tar.bz2
rails-db619c4a4115d5eeca9473f8f77f34c877e4e1dd.zip
Sync 'rails/rails/master'
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb4
-rw-r--r--actionpack/lib/action_controller/dispatcher.rb2
-rwxr-xr-xactionpack/lib/action_controller/request.rb20
-rw-r--r--actionpack/lib/action_controller/request_parser.rb7
-rw-r--r--actionpack/lib/action_controller/rescue.rb4
5 files changed, 18 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index aa604395a9..1093a9bc04 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -384,8 +384,8 @@ module ActionController #:nodoc:
class << self
def call(env)
# HACK: For global rescue to have access to the original request and response
- request = env["actioncontroller.rescue.request"] ||= Request.new(env)
- response = env["actioncontroller.rescue.response"] ||= Response.new
+ request = env["action_controller.rescue.request"] ||= Request.new(env)
+ response = env["action_controller.rescue.response"] ||= Response.new
process(request, response)
end
diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb
index d5af45f0da..781bc48887 100644
--- a/actionpack/lib/action_controller/dispatcher.rb
+++ b/actionpack/lib/action_controller/dispatcher.rb
@@ -8,6 +8,8 @@ module ActionController
# Development mode callbacks
before_dispatch :reload_application
after_dispatch :cleanup_application
+
+ ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false
end
if defined?(ActiveRecord)
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index 393923104c..f12213d3ba 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -19,6 +19,7 @@ module ActionController
def initialize(env)
@env = env
+ @parser = ActionController::RequestParser.new(env)
end
%w[ AUTH_TYPE GATEWAY_INTERFACE PATH_INFO
@@ -92,16 +93,15 @@ module ActionController
# Returns the content length of the request as an integer.
def content_length
- @env['CONTENT_LENGTH'].to_i
+ @env["action_controller.request.content_length"] ||= @env['CONTENT_LENGTH'].to_i
end
- memoize :content_length
# The MIME type of the HTTP request, such as Mime::XML.
#
# For backward compatibility, the post \format is extracted from the
# X-Post-Data-Format HTTP header if present.
def content_type
- Mime::Type.lookup(parser.content_type_without_parameters)
+ Mime::Type.lookup(@parser.content_type_without_parameters)
end
memoize :content_type
@@ -398,7 +398,7 @@ EOM
# Read the request \body. This is useful for web services that need to
# work with raw requests directly.
def raw_post
- parser.raw_post
+ @parser.raw_post
end
# Returns both GET and POST \parameters in a single hash.
@@ -427,7 +427,7 @@ EOM
end
def body
- parser.body
+ @parser.body
end
def remote_addr
@@ -440,11 +440,11 @@ EOM
alias referer referrer
def query_parameters
- @query_parameters ||= parser.query_parameters
+ @parser.query_parameters
end
def request_parameters
- @request_parameters ||= parser.request_parameters
+ @parser.request_parameters
end
def body_stream #:nodoc:
@@ -460,7 +460,7 @@ EOM
end
def session=(session) #:nodoc:
- @session = session
+ @env['rack.session'] = session
end
def reset_session
@@ -483,9 +483,5 @@ EOM
def named_host?(host)
!(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
end
-
- def parser
- @parser ||= ActionController::RequestParser.new(@env)
- end
end
end
diff --git a/actionpack/lib/action_controller/request_parser.rb b/actionpack/lib/action_controller/request_parser.rb
index 82ee4c84c4..20d53f5d92 100644
--- a/actionpack/lib/action_controller/request_parser.rb
+++ b/actionpack/lib/action_controller/request_parser.rb
@@ -2,14 +2,15 @@ module ActionController
class RequestParser
def initialize(env)
@env = env
+ freeze
end
def request_parameters
- @request_parameters ||= parse_formatted_request_parameters
+ @env["action_controller.request_parser.request_parameters"] ||= parse_formatted_request_parameters
end
def query_parameters
- @query_parameters ||= self.class.parse_query_parameters(query_string)
+ @env["action_controller.request_parser.query_parameters"] ||= self.class.parse_query_parameters(query_string)
end
# Returns the query string, accounting for server idiosyncrasies.
@@ -90,7 +91,7 @@ module ActionController
end
def content_length
- @content_length ||= @env['CONTENT_LENGTH'].to_i
+ @env["action_controller.request.content_length"] ||= @env['CONTENT_LENGTH'].to_i
end
# The raw content type string. Use when you need parameters such as
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index 8824d983b4..4b7d1e32fd 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -60,8 +60,8 @@ module ActionController #:nodoc:
module ClassMethods
def call_with_exception(env, exception) #:nodoc:
- request = env["actioncontroller.rescue.request"] ||= Request.new(env)
- response = env["actioncontroller.rescue.response"] ||= Response.new
+ request = env["action_controller.rescue.request"] ||= Request.new(env)
+ response = env["action_controller.rescue.response"] ||= Response.new
new.process(request, response, :rescue_action, exception)
end
end