mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Reduce Hash object creation when normalizing request env
This commit is contained in:
parent
05060ddba1
commit
a1d7d4c6dc
1 changed files with 3 additions and 2 deletions
|
@ -65,7 +65,7 @@ module ActionController
|
||||||
def initialize(controller, env, defaults)
|
def initialize(controller, env, defaults)
|
||||||
@controller = controller
|
@controller = controller
|
||||||
@defaults = defaults
|
@defaults = defaults
|
||||||
@env = normalize_keys defaults.merge(env)
|
@env = normalize_keys defaults, env
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render templates with any options from ActionController::Base#render_to_string.
|
# Render templates with any options from ActionController::Base#render_to_string.
|
||||||
|
@ -97,8 +97,9 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def normalize_keys(env)
|
def normalize_keys(defaults, env)
|
||||||
new_env = {}
|
new_env = {}
|
||||||
|
defaults.each_pair { |k, v| new_env[rack_key_for(k)] = rack_value_for(k, v) }
|
||||||
env.each_pair { |k, v| new_env[rack_key_for(k)] = rack_value_for(k, v) }
|
env.each_pair { |k, v| new_env[rack_key_for(k)] = rack_value_for(k, v) }
|
||||||
new_env["rack.url_scheme"] = new_env["HTTPS"] == "on" ? "https" : "http"
|
new_env["rack.url_scheme"] = new_env["HTTPS"] == "on" ? "https" : "http"
|
||||||
new_env
|
new_env
|
||||||
|
|
Loading…
Reference in a new issue