From 3d32a50ca1933ee96abbe5db7ee99617fd0c328c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 5 Aug 2015 18:17:13 -0700 Subject: remove `@host` ivar --- actionpack/lib/action_dispatch/middleware/cookies.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 275e16c802..41c4523ecb 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -259,16 +259,14 @@ module ActionDispatch DOMAIN_REGEXP = /[^.]*\.([^.]*|..\...|...\...)$/ def self.build(req, cookies) - host = req.host - new(host, req).tap do |hash| + new(req).tap do |hash| hash.update(cookies) end end - def initialize(host = nil, request) + def initialize(request) @set_cookies = {} @delete_cookies = {} - @host = host @request = request @cookies = {} @committed = false @@ -318,12 +316,12 @@ module ActionDispatch # if host is not ip and matches domain regexp # (ip confirms to domain regexp so we explicitly check for ip) - options[:domain] = if (@host !~ /^[\d.]+$/) && (@host =~ domain_regexp) + options[:domain] = if (@request.host !~ /^[\d.]+$/) && (@request.host =~ domain_regexp) ".#{$&}" end elsif options[:domain].is_a? Array # if host matches one of the supplied domains without a dot in front of it - options[:domain] = options[:domain].find {|domain| @host.include? domain.sub(/^\./, '') } + options[:domain] = options[:domain].find {|domain| @request.host.include? domain.sub(/^\./, '') } end end -- cgit v1.2.3