rack-auth-cookie 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module Rack
6
6
  module Auth
7
7
  class Cookie
8
8
  # The version of the rack-auth-cookie library.
9
- VERSION = '0.7.3'
9
+ VERSION = '0.7.4'
10
10
 
11
11
  # Creates a new Rack::Auth::Cookie object.
12
12
  #
@@ -202,7 +202,7 @@ module Rack
202
202
  def self.create_auth_cookie(env)
203
203
  cookie_value = create_auth_token(env)
204
204
  cookie = "#{@@cookie_name}=#{URI.escape(cookie_value)}; "
205
- cookie += "domain=.#{top_level_domain(env)}; " if @@cookie_domain
205
+ cookie += "domain=#{cookie_domain(env)}; "
206
206
  cookie += "path=/; "
207
207
  cookie += "HttpOnly; "
208
208
  end
@@ -210,7 +210,7 @@ module Rack
210
210
  def self.create_clear_cookie(env)
211
211
  cookie_value = ""
212
212
  cookie = "#{@@cookie_name}=; "
213
- cookie += "domain=.#{top_level_domain(env)}; " if @@cookie_domain
213
+ cookie += "domain=#{cookie_domain(env)}; "
214
214
  cookie += "path=/; "
215
215
  cookie += "expires=Thu, 01-Jan-1970 00:00:00 GMT; "
216
216
  cookie += "HttpOnly; "
@@ -233,10 +233,20 @@ module Rack
233
233
  raw_host_with_port(env).sub(/:\d+$/, '')
234
234
  end
235
235
 
236
- def self.top_level_domain(env)
237
- components = host(env).split('.')
238
- components.slice!(0, @@domain_tree_depth)
239
- components.join('.')
236
+ def self.cookie_domain(env)
237
+ result = host(env)
238
+
239
+ if @@domain_tree_depth != nil
240
+ components = result.split('.')
241
+ components.slice!(0, @@domain_tree_depth)
242
+ result = components.join('.')
243
+ end
244
+
245
+ if @@share_with_subdomains
246
+ result += "."
247
+ end
248
+
249
+ result
240
250
  end
241
251
  end
242
252
  end
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'rack-auth-cookie'
5
- gem.version = '0.7.3'
5
+ gem.version = '0.7.4'
6
6
  gem.authors = ["Daniel Berger", "Charlie O'Keefe"]
7
7
  gem.email = 'cokeefe@globe.gov'
8
8
  gem.homepage = 'http://www.github.com/charlieok/rack-auth-cookie'
@@ -9,7 +9,7 @@ class TC_Rack_Auth_Cookie < Test::Unit::TestCase
9
9
  end
10
10
 
11
11
  def test_version
12
- assert_equal('0.7.3', Rack::Auth::Cookie::VERSION)
12
+ assert_equal('0.7.4', Rack::Auth::Cookie::VERSION)
13
13
  end
14
14
 
15
15
  def test_constructor_basic
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-auth-cookie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 4
10
+ version: 0.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Berger