diff options
author | Matthew Draper <matthew@trebex.net> | 2017-07-10 00:07:03 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 00:07:03 +0930 |
commit | 551f88366dcbaed3b0abc89bddd63975c4c9a5ca (patch) | |
tree | ab9306fac3d48ff7dc8556076c8d07b38bcfc381 /actionpack/lib/action_dispatch/middleware | |
parent | 8d98bb0cc6e2baf1694971ae2bdf19e8b8bcdce5 (diff) | |
parent | b3f3d49fd6b91c6573b3e10e3d00f65306638927 (diff) | |
download | rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.tar.gz rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.tar.bz2 rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.zip |
Merge pull request #29655 from kirs/frozen-friendly-ap-ar
Prepare AP and AR to be frozen string friendly
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/debug_exceptions.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/ssl.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb index d42b35a4cf..18852b0a57 100644 --- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative "../http/request" require_relative "exception_wrapper" require_relative "../routing/inspector" @@ -21,7 +22,7 @@ module ActionDispatch if clean_params.empty? "None" else - PP.pp(clean_params, "", 200) + PP.pp(clean_params, "".dup, 200) end end diff --git a/actionpack/lib/action_dispatch/middleware/ssl.rb b/actionpack/lib/action_dispatch/middleware/ssl.rb index 557721c301..e79404c993 100644 --- a/actionpack/lib/action_dispatch/middleware/ssl.rb +++ b/actionpack/lib/action_dispatch/middleware/ssl.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionDispatch # This middleware is added to the stack when `config.force_ssl = true`, and is passed # the options set in `config.ssl_options`. It does three jobs to enforce secure HTTP @@ -94,7 +95,7 @@ module ActionDispatch # http://tools.ietf.org/html/rfc6797#section-6.1 def build_hsts_header(hsts) - value = "max-age=#{hsts[:expires].to_i}" + value = "max-age=#{hsts[:expires].to_i}".dup value << "; includeSubDomains" if hsts[:subdomains] value << "; preload" if hsts[:preload] value @@ -133,7 +134,7 @@ module ActionDispatch host = @redirect[:host] || request.host port = @redirect[:port] || request.port - location = "https://#{host}" + location = "https://#{host}".dup location << ":#{port}" if port != 80 && port != 443 location << request.fullpath location diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index fb99f13a1c..6f4a97da3e 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rack/utils" require "active_support/core_ext/uri" @@ -33,7 +34,7 @@ module ActionDispatch paths = [path, "#{path}#{ext}", "#{path}/#{@index}#{ext}"] if match = paths.detect { |p| - path = File.join(@root, p.force_encoding(Encoding::UTF_8)) + path = File.join(@root, p.dup.force_encoding(Encoding::UTF_8)) begin File.file?(path) && File.readable?(path) rescue SystemCallError |