Skip to content

Commit

Permalink
synchronize on param filter cache.
Browse files Browse the repository at this point in the history
Do we actually need this cache?
  • Loading branch information
tenderlove committed Oct 19, 2012
1 parent 8654f8c commit 0d7b0f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions 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'

Expand All @@ -20,7 +21,7 @@ module Http
# 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:
Expand Down Expand Up @@ -64,7 +65,11 @@ def env_filter
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 = '[^&;=]+'
Expand Down

0 comments on commit 0d7b0f0

Please sign in to comment.