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

remove @host ivar

This commit is contained in:
Aaron Patterson 2015-08-05 18:17:13 -07:00
parent aad33d5808
commit 3d32a50ca1
2 changed files with 5 additions and 13 deletions

View file

@ -139,7 +139,7 @@ module ActionController #:nodoc:
request.session = NullSessionHash.new(request.env)
request.env['action_dispatch.request.flash_hash'] = nil
request.env['rack.session.options'] = { skip: true }
request.env['action_dispatch.cookies'] = NullCookieJar.build(request)
request.env['action_dispatch.cookies'] = NullCookieJar.build(request, {})
end
protected
@ -160,12 +160,6 @@ module ActionController #:nodoc:
end
class NullCookieJar < ActionDispatch::Cookies::CookieJar #:nodoc:
def self.build(request)
host = request.host
new(host, request)
end
def write(*)
# nothing
end

View file

@ -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