diff options
author | brainopia <ravwar@gmail.com> | 2010-12-09 18:38:52 +0300 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-16 01:49:30 +0530 |
commit | ebc47465a5865ab91dc7d058d2d8a0cc961510d7 (patch) | |
tree | eabe94ecf138ee60c7bd8398c4ac36904b3d7b10 /actionpack/lib/action_dispatch | |
parent | 875bbd58b4175a1219c5f7615946d0b89e51182d (diff) | |
download | rails-ebc47465a5865ab91dc7d058d2d8a0cc961510d7.tar.gz rails-ebc47465a5865ab91dc7d058d2d8a0cc961510d7.tar.bz2 rails-ebc47465a5865ab91dc7d058d2d8a0cc961510d7.zip |
Fix edge cases for domain :all option on cookie store
Dont set explicit domain for cookies if host is not a domain name
[#6002 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index b0a4e3d949..f369d2d3c2 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -131,8 +131,11 @@ module ActionDispatch options[:path] ||= "/" if options[:domain] == :all - @host =~ DOMAIN_REGEXP - options[:domain] = ".#{$1}.#{$2}" + # 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) + ".#{$1}.#{$2}" + end end end |