diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 18:13:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-18 18:13:01 -0700 |
commit | 0d7b0f0183ce9f1bfc524cf6afd5d7de852ebc76 (patch) | |
tree | 1795b8bef68bd9bd9b1c91cd06a40e3a54d4f0be /actionpack/lib/action_dispatch | |
parent | 8654f8c5e9d50c8410376241e7ddc0a869929e4a (diff) | |
download | rails-0d7b0f0183ce9f1bfc524cf6afd5d7de852ebc76.tar.gz rails-0d7b0f0183ce9f1bfc524cf6afd5d7de852ebc76.tar.bz2 rails-0d7b0f0183ce9f1bfc524cf6afd5d7de852ebc76.zip |
synchronize on param filter cache.
Do we actually need this cache?
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/filter_parameters.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_parameters.rb b/actionpack/lib/action_dispatch/http/filter_parameters.rb index bf6d3ade87..4a7df6b657 100644 --- a/actionpack/lib/action_dispatch/http/filter_parameters.rb +++ b/actionpack/lib/action_dispatch/http/filter_parameters.rb @@ -1,3 +1,4 @@ +require 'mutex_m' require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/object/duplicable' @@ -20,7 +21,7 @@ module ActionDispatch # end # => reverses the value to all keys matching /secret/i module FilterParameters - @@parameter_filter_for = {} + @@parameter_filter_for = {}.extend(Mutex_m) ENV_MATCH = [/RAW_POST_DATA/, "rack.request.form_vars"] # :nodoc: NULL_PARAM_FILTER = ParameterFilter.new # :nodoc: @@ -64,7 +65,11 @@ module ActionDispatch end def parameter_filter_for(filters) - @@parameter_filter_for[filters] ||= ParameterFilter.new(filters) + @@parameter_filter_for.synchronize do + # Do we *actually* need this cache? Constructing ParameterFilters + # doesn't seem too expensive. + @@parameter_filter_for[filters] ||= ParameterFilter.new(filters) + end end KV_RE = '[^&;=]+' |