1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reduce String allocations while handling HTTP headers

This commit is contained in:
Akira Matsuda 2019-08-19 00:02:39 +09:00
parent 934b104fb0
commit c45eaffa27

View file

@ -121,8 +121,9 @@ module ActionDispatch
def env_name(key)
key = key.to_s
if HTTP_HEADER.match?(key)
key = key.upcase.tr("-", "_")
key = "HTTP_" + key unless CGI_VARIABLES.include?(key)
key = key.upcase
key.tr!("-", "_")
key.prepend("HTTP_") unless CGI_VARIABLES.include?(key)
end
key
end