about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJustin Tracey <j2tracey@gmail.com>2021-02-16 14:28:17 +0000
committerGitHub <noreply@github.com>2021-02-16 15:28:17 +0100
commit3f8523130da1029ba64d00c03360a2c15f85d9d6 (patch)
tree06f07a6cb34f6b45df23a55fd77152c8f3e45ae9
parent9c273c2a59755a46ff3933470b02df857537a4af (diff)
use host instead of headers to make Rack happy (#15741)
"headers" is provided by Rails, Rack can't rely on it
-rw-r--r--lib/action_dispatch/cookie_jar_extensions.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/action_dispatch/cookie_jar_extensions.rb b/lib/action_dispatch/cookie_jar_extensions.rb
index f7ffb6cc7..492c04065 100644
--- a/lib/action_dispatch/cookie_jar_extensions.rb
+++ b/lib/action_dispatch/cookie_jar_extensions.rb
@@ -7,7 +7,7 @@ module ActionDispatch
     # Monkey-patch ActionDispatch to serve secure cookies to Tor Hidden Service
     # users. Otherwise, ActionDispatch would drop the cookie over HTTP.
     def write_cookie?(*)
-      request.headers['Host'].ends_with?('.onion') || super
+      request.host.ends_with?('.onion') || super
     end
   end
 end
@@ -17,7 +17,7 @@ ActionDispatch::Cookies::CookieJar.prepend(ActionDispatch::CookieJarExtensions)
 module Rack
   module SessionPersistedExtensions
     def security_matches?(request, options)
-      request.headers['Host'].ends_with?('.onion') || super
+      request.host.ends_with?('.onion') || super
     end
   end
 end