http-cookie 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/ci.yml +2 -2
- data/README.md +5 -2
- data/lib/http/cookie/scanner.rb +4 -3
- data/lib/http/cookie/uri_parser.rb +36 -0
- data/lib/http/cookie/version.rb +1 -1
- data/lib/http/cookie.rb +8 -6
- data/lib/http/cookie_jar/abstract_store.rb +1 -1
- data/lib/http/cookie_jar.rb +1 -1
- data/test/helper.rb +2 -2
- data/test/test_http_cookie.rb +35 -12
- data/test/test_http_cookie_jar.rb +39 -3
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd2affae74acb780842ead781a250bf2fe174fd034417391224ded71767cc08a
|
4
|
+
data.tar.gz: 77f5ed5bdf3b14002399d237e3d86eb655f2d27da1c3aafd5725338565c24b08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5121ba37a869a8aa52c2efbc2ac3909715883d49203374c8997a3ceeceb84b15e674c77b5ccb0ad5a8cfcea593bfc8c707a96ff4b3ee7a5634302195e8a50ee5
|
7
|
+
data.tar.gz: 8cb0b6b1ed0b5e9f952031b677a3d8e28d2d14c4a4036e335bfe3ce433743408ce6d1aaa8a23545777328a31cf1e095fc85dde84ddbc056e2ef4fc1e6d2e83be
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @knu
|
data/.github/workflows/ci.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
matrix:
|
16
16
|
os: [ubuntu]
|
17
17
|
# We still kind of support Ruby 1.8.7
|
18
|
-
ruby: [2.7, "3.0", 3.1, head, jruby]
|
18
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "head", "jruby"]
|
19
19
|
|
20
20
|
name: >-
|
21
21
|
${{matrix.os}}:ruby-${{matrix.ruby}}
|
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
|
25
25
|
steps:
|
26
26
|
- name: Check out
|
27
|
-
uses: actions/checkout@
|
27
|
+
uses: actions/checkout@v4
|
28
28
|
|
29
29
|
- name: Set up ruby and bundle
|
30
30
|
uses: ruby/setup-ruby@v1
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/http-cookie)
|
2
|
+
|
1
3
|
# HTTP::Cookie
|
2
4
|
|
3
5
|
HTTP::Cookie is a ruby library to handle HTTP cookies in a way both
|
@@ -20,7 +22,8 @@ The following is an incomplete list of its features:
|
|
20
22
|
* It takes eTLD (effective TLD, also known as "Public Suffix") into
|
21
23
|
account just as major browsers do, to reject cookies with an eTLD
|
22
24
|
domain like "org", "co.jp", or "appspot.com". This feature is
|
23
|
-
brought to you by the
|
25
|
+
brought to you by the
|
26
|
+
[domain_name](https://github.com/knu/ruby-domain_name) gem.
|
24
27
|
|
25
28
|
* The number of cookies and the size are properly capped so that a
|
26
29
|
cookie store does not get flooded.
|
@@ -207,7 +210,7 @@ equivalent using HTTP::Cookie:
|
|
207
210
|
guarantee that it will remain available in the future.
|
208
211
|
|
209
212
|
|
210
|
-
HTTP::Cookie/CookieJar
|
213
|
+
HTTP::Cookie/CookieJar raises runtime errors to help migration, so
|
211
214
|
after replacing the class names, try running your test code once to
|
212
215
|
find out how to fix your code base.
|
213
216
|
|
data/lib/http/cookie/scanner.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'http/cookie'
|
2
3
|
require 'strscan'
|
3
4
|
require 'time'
|
@@ -23,7 +24,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
23
24
|
class << self
|
24
25
|
def quote(s)
|
25
26
|
return s unless s.match(RE_BAD_CHAR)
|
26
|
-
'"' << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
27
|
+
(+'"') << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -32,7 +33,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def scan_dquoted
|
35
|
-
''.tap { |s|
|
36
|
+
(+'').tap { |s|
|
36
37
|
case
|
37
38
|
when skip(/"/)
|
38
39
|
break
|
@@ -51,7 +52,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def scan_value(comma_as_separator = false)
|
54
|
-
''.tap { |s|
|
55
|
+
(+'').tap { |s|
|
55
56
|
case
|
56
57
|
when scan(/[^,;"]+/)
|
57
58
|
s << matched
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module HTTP::Cookie::URIParser
|
2
|
+
module_function
|
3
|
+
|
4
|
+
# Regular Expression taken from RFC 3986 Appendix B
|
5
|
+
URIREGEX = %r{
|
6
|
+
\A
|
7
|
+
(?: (?<scheme> [^:/?\#]+ ) : )?
|
8
|
+
(?: // (?<authority> [^/?\#]* ) )?
|
9
|
+
(?<path> [^?\#]* )
|
10
|
+
(?: \? (?<query> [^\#]* ) )?
|
11
|
+
(?: \# (?<fragment> .* ) )?
|
12
|
+
\z
|
13
|
+
}x
|
14
|
+
|
15
|
+
# Escape RFC 3986 "reserved" characters minus valid characters for path
|
16
|
+
# More specifically, gen-delims minus "/" / "?" / "#"
|
17
|
+
def escape_path(path)
|
18
|
+
path.sub(/\A[^?#]+/) { |p| p.gsub(/[:\[\]@]+/) { |r| CGI.escape(r) } }
|
19
|
+
end
|
20
|
+
|
21
|
+
# Parse a URI string or object, relaxing the constraints on the path component
|
22
|
+
def parse(uri)
|
23
|
+
URI(uri)
|
24
|
+
rescue URI::InvalidURIError
|
25
|
+
str = String.try_convert(uri) or
|
26
|
+
raise ArgumentError, "bad argument (expected URI object or URI string)"
|
27
|
+
|
28
|
+
m = URIREGEX.match(str) or raise
|
29
|
+
|
30
|
+
path = m[:path]
|
31
|
+
str[m.begin(:path)...m.end(:path)] = escape_path(path)
|
32
|
+
uri = URI.parse(str)
|
33
|
+
uri.__send__(:set_path, path)
|
34
|
+
uri
|
35
|
+
end
|
36
|
+
end
|
data/lib/http/cookie/version.rb
CHANGED
data/lib/http/cookie.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# :markup: markdown
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'http/cookie/version'
|
4
|
+
require 'http/cookie/uri_parser'
|
3
5
|
require 'time'
|
4
6
|
require 'uri'
|
5
7
|
require 'domain_name'
|
@@ -275,7 +277,7 @@ class HTTP::Cookie
|
|
275
277
|
logger = options[:logger]
|
276
278
|
created_at = options[:created_at]
|
277
279
|
end
|
278
|
-
origin =
|
280
|
+
origin = HTTP::Cookie::URIParser.parse(origin)
|
279
281
|
|
280
282
|
[].tap { |cookies|
|
281
283
|
Scanner.new(set_cookie, logger).scan_set_cookie { |name, value, attrs|
|
@@ -424,7 +426,7 @@ class HTTP::Cookie
|
|
424
426
|
# Returns the domain, with a dot prefixed only if the domain flag is
|
425
427
|
# on.
|
426
428
|
def dot_domain
|
427
|
-
@for_domain ? '.' << @domain : @domain
|
429
|
+
@for_domain ? (+'.') << @domain : @domain
|
428
430
|
end
|
429
431
|
|
430
432
|
# Returns the domain attribute value as a DomainName object.
|
@@ -455,7 +457,7 @@ class HTTP::Cookie
|
|
455
457
|
@origin.nil? or
|
456
458
|
raise ArgumentError, "origin cannot be changed once it is set"
|
457
459
|
# Delay setting @origin because #domain= or #path= may fail
|
458
|
-
origin =
|
460
|
+
origin = HTTP::Cookie::URIParser.parse(origin)
|
459
461
|
if URI::HTTP === origin
|
460
462
|
self.domain ||= origin.host
|
461
463
|
self.path ||= (origin + './').path
|
@@ -548,7 +550,7 @@ class HTTP::Cookie
|
|
548
550
|
# Tests if it is OK to accept this cookie if it is sent from a given
|
549
551
|
# URI/URL, `uri`.
|
550
552
|
def acceptable_from_uri?(uri)
|
551
|
-
uri =
|
553
|
+
uri = HTTP::Cookie::URIParser.parse(uri)
|
552
554
|
return false unless URI::HTTP === uri && uri.host
|
553
555
|
host = DomainName.new(uri.host)
|
554
556
|
|
@@ -585,7 +587,7 @@ class HTTP::Cookie
|
|
585
587
|
if @domain.nil?
|
586
588
|
raise "cannot tell if this cookie is valid because the domain is unknown"
|
587
589
|
end
|
588
|
-
uri =
|
590
|
+
uri = HTTP::Cookie::URIParser.parse(uri)
|
589
591
|
# RFC 6265 5.4
|
590
592
|
return false if secure? && !(URI::HTTPS === uri)
|
591
593
|
acceptable_from_uri?(uri) && HTTP::Cookie.path_match?(@path, uri.path)
|
@@ -594,7 +596,7 @@ class HTTP::Cookie
|
|
594
596
|
# Returns a string for use in the Cookie header, i.e. `name=value`
|
595
597
|
# or `name="value"`.
|
596
598
|
def cookie_value
|
597
|
-
"#{@name}=#{Scanner.quote(@value)}"
|
599
|
+
+"#{@name}=#{Scanner.quote(@value)}"
|
598
600
|
end
|
599
601
|
alias to_s cookie_value
|
600
602
|
|
@@ -18,7 +18,7 @@ class HTTP::CookieJar::AbstractStore
|
|
18
18
|
require 'http/cookie_jar/%s_store' % symbol
|
19
19
|
@@class_map.fetch(symbol)
|
20
20
|
rescue LoadError, IndexError => e
|
21
|
-
raise IndexError, 'cookie store unavailable: %s, error: %s' % symbol.inspect, e.message
|
21
|
+
raise IndexError, 'cookie store unavailable: %s, error: %s' % [symbol.inspect, e.message]
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/lib/http/cookie_jar.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -7,7 +7,7 @@ module Test
|
|
7
7
|
module Unit
|
8
8
|
module Assertions
|
9
9
|
def assert_warn(pattern, message = nil, &block)
|
10
|
-
class << (output = "")
|
10
|
+
class << (output = +"")
|
11
11
|
alias write <<
|
12
12
|
end
|
13
13
|
stderr, $stderr = $stderr, output
|
@@ -50,6 +50,6 @@ end
|
|
50
50
|
|
51
51
|
def sleep_until(time)
|
52
52
|
if (s = time - Time.now) > 0
|
53
|
-
sleep s
|
53
|
+
sleep s + 0.01
|
54
54
|
end
|
55
55
|
end
|
data/test/test_http_cookie.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: false
|
2
3
|
require File.expand_path('helper', File.dirname(__FILE__))
|
3
4
|
require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2"
|
4
5
|
require 'yaml'
|
@@ -302,7 +303,8 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
302
303
|
"name=Aaron; Domain=localhost; Expires=Sun, 06 Nov 2011 00:29:51 GMT; Path=/, " \
|
303
304
|
"name=Aaron; Domain=localhost; Expires=Sun, 06 Nov 2011 00:29:51 GMT; Path=/; HttpOnly, " \
|
304
305
|
"expired=doh; Expires=Fri, 04 Nov 2011 00:29:51 GMT; Path=/, " \
|
305
|
-
"
|
306
|
+
"a_path1=some_path; Expires=Sun, 06 Nov 2011 00:29:51 GMT; Path=/some_path, " \
|
307
|
+
"a_path2=some_path; Expires=Sun, 06 Nov 2011 00:29:51 GMT; Path=/some_path[], " \
|
306
308
|
"no_path1=no_path; Expires=Sun, 06 Nov 2011 00:29:52 GMT, no_expires=nope; Path=/, " \
|
307
309
|
"no_path2=no_path; Expires=Sun, 06 Nov 2011 00:29:52 GMT; no_expires=nope; Path, " \
|
308
310
|
"no_path3=no_path; Expires=Sun, 06 Nov 2011 00:29:52 GMT; no_expires=nope; Path=, " \
|
@@ -313,17 +315,22 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
313
315
|
"no_domain3=no_domain; Expires=Sun, 06 Nov 2011 00:29:53 GMT; no_expires=nope; Domain="
|
314
316
|
|
315
317
|
cookies = HTTP::Cookie.parse cookie_str, url
|
316
|
-
assert_equal
|
318
|
+
assert_equal 16, cookies.length
|
317
319
|
|
318
320
|
name = cookies.find { |c| c.name == 'name' }
|
319
321
|
assert_equal "Aaron", name.value
|
320
322
|
assert_equal "/", name.path
|
321
323
|
assert_equal Time.at(1320539391), name.expires
|
322
324
|
|
323
|
-
|
324
|
-
assert_equal "some_path",
|
325
|
-
assert_equal "/some_path",
|
326
|
-
assert_equal Time.at(1320539391),
|
325
|
+
a_path1 = cookies.find { |c| c.name == 'a_path1' }
|
326
|
+
assert_equal "some_path", a_path1.value
|
327
|
+
assert_equal "/some_path", a_path1.path
|
328
|
+
assert_equal Time.at(1320539391), a_path1.expires
|
329
|
+
|
330
|
+
a_path2 = cookies.find { |c| c.name == 'a_path2' }
|
331
|
+
assert_equal "some_path", a_path2.value
|
332
|
+
assert_equal "/some_path[]", a_path2.path
|
333
|
+
assert_equal Time.at(1320539391), a_path2.expires
|
327
334
|
|
328
335
|
no_expires = cookies.find { |c| c.name == 'no_expires' }
|
329
336
|
assert_equal "nope", no_expires.value
|
@@ -751,7 +758,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
751
758
|
assert_equal 12, cookie.max_age
|
752
759
|
|
753
760
|
cookie.max_age = -3
|
754
|
-
assert_equal
|
761
|
+
assert_equal(-3, cookie.max_age)
|
755
762
|
end
|
756
763
|
|
757
764
|
def test_session
|
@@ -941,6 +948,10 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
941
948
|
cookie.origin = URI.parse('http://www.example.com/')
|
942
949
|
}
|
943
950
|
|
951
|
+
cookie = HTTP::Cookie.new('a', 'b')
|
952
|
+
cookie.origin = HTTP::Cookie::URIParser.parse('http://example.com/path[]/')
|
953
|
+
assert_equal '/path[]/', cookie.path
|
954
|
+
|
944
955
|
cookie = HTTP::Cookie.new('a', 'b', :domain => '.example.com')
|
945
956
|
cookie.origin = URI.parse('http://example.org/')
|
946
957
|
assert_equal false, cookie.acceptable?
|
@@ -1006,7 +1017,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
1006
1017
|
'https://www.example.com/dir2/test.html',
|
1007
1018
|
]
|
1008
1019
|
},
|
1009
|
-
HTTP::Cookie.parse('
|
1020
|
+
HTTP::Cookie.parse('a3=b; domain=example.com; path=/dir2/',
|
1010
1021
|
URI('http://example.com/dir/file.html')).first => {
|
1011
1022
|
true => [
|
1012
1023
|
'https://example.com/dir2/test.html',
|
@@ -1022,7 +1033,19 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
1022
1033
|
'file:///dir2/test.html',
|
1023
1034
|
]
|
1024
1035
|
},
|
1025
|
-
HTTP::Cookie.parse('a4=b;
|
1036
|
+
HTTP::Cookie.parse('a4=b; domain=example.com; path=/dir2[]/',
|
1037
|
+
HTTP::Cookie::URIParser.parse('http://example.com/dir[]/file.html')).first => {
|
1038
|
+
true => [
|
1039
|
+
HTTP::Cookie::URIParser.parse('https://example.com/dir2[]/file.html'),
|
1040
|
+
HTTP::Cookie::URIParser.parse('http://example.com/dir2[]/file.html'),
|
1041
|
+
],
|
1042
|
+
false => [
|
1043
|
+
HTTP::Cookie::URIParser.parse('https://example.com/dir[]/file.html'),
|
1044
|
+
HTTP::Cookie::URIParser.parse('http://example.com/dir[]/file.html'),
|
1045
|
+
'file:///dir2/test.html',
|
1046
|
+
]
|
1047
|
+
},
|
1048
|
+
HTTP::Cookie.parse('a5=b; secure',
|
1026
1049
|
URI('https://example.com/dir/file.html')).first => {
|
1027
1050
|
true => [
|
1028
1051
|
'https://example.com/dir/test.html',
|
@@ -1034,7 +1057,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
1034
1057
|
'file:///dir2/test.html',
|
1035
1058
|
]
|
1036
1059
|
},
|
1037
|
-
HTTP::Cookie.parse('
|
1060
|
+
HTTP::Cookie.parse('a6=b',
|
1038
1061
|
URI('https://example.com/')).first => {
|
1039
1062
|
true => [
|
1040
1063
|
'https://example.com',
|
@@ -1043,7 +1066,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
1043
1066
|
'file:///',
|
1044
1067
|
]
|
1045
1068
|
},
|
1046
|
-
HTTP::Cookie.parse('
|
1069
|
+
HTTP::Cookie.parse('a7=b; path=/dir',
|
1047
1070
|
'http://example.com/dir/file.html').first => {
|
1048
1071
|
true => [
|
1049
1072
|
'http://example.com/dir',
|
@@ -1069,7 +1092,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
1069
1092
|
hash.each { |expected, urls|
|
1070
1093
|
urls.each { |url|
|
1071
1094
|
assert_equal expected, cookie.valid_for_uri?(url), '%s: %s' % [cookie.name, url]
|
1072
|
-
assert_equal expected, cookie.valid_for_uri?(
|
1095
|
+
assert_equal expected, cookie.valid_for_uri?(HTTP::Cookie::URIParser.parse(url)), "%s: URI(%s)" % [cookie.name, url]
|
1073
1096
|
}
|
1074
1097
|
}
|
1075
1098
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: false
|
1
2
|
require File.expand_path('helper', File.dirname(__FILE__))
|
2
3
|
require 'tmpdir'
|
3
4
|
|
@@ -9,6 +10,13 @@ module TestHTTPCookieJar
|
|
9
10
|
}
|
10
11
|
end
|
11
12
|
|
13
|
+
def test_nonexistent_store_in_config
|
14
|
+
expected = /cookie store unavailable: :nonexistent, error: (cannot load|no such file to load) .*nonexistent_store/
|
15
|
+
assert_raise_with_message(ArgumentError, expected) {
|
16
|
+
HTTP::CookieJar.new(store: :nonexistent)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
12
20
|
def test_erroneous_store
|
13
21
|
Dir.mktmpdir { |dir|
|
14
22
|
Dir.mkdir(File.join(dir, 'http'))
|
@@ -465,7 +473,7 @@ module TestHTTPCookieJar
|
|
465
473
|
end
|
466
474
|
|
467
475
|
def test_save_and_read_cookiestxt
|
468
|
-
url =
|
476
|
+
url = HTTP::Cookie::URIParser.parse('https://rubyforge.org/foo[]/')
|
469
477
|
|
470
478
|
# Add one cookie with an expiration date in the future
|
471
479
|
cookie = HTTP::Cookie.new(cookie_values)
|
@@ -474,7 +482,7 @@ module TestHTTPCookieJar
|
|
474
482
|
:expires => nil))
|
475
483
|
cookie2 = HTTP::Cookie.new(cookie_values(:name => 'Baz',
|
476
484
|
:value => 'Foo#Baz',
|
477
|
-
:path => '/foo/',
|
485
|
+
:path => '/foo[]/',
|
478
486
|
:for_domain => false))
|
479
487
|
h_cookie = HTTP::Cookie.new(cookie_values(:name => 'Quux',
|
480
488
|
:value => 'Foo#Quux',
|
@@ -523,7 +531,7 @@ module TestHTTPCookieJar
|
|
523
531
|
assert_equal 'Foo#Baz', cookie.value
|
524
532
|
assert_equal 'rubyforge.org', cookie.domain
|
525
533
|
assert_equal false, cookie.for_domain
|
526
|
-
assert_equal '/foo/', cookie.path
|
534
|
+
assert_equal '/foo[]/', cookie.path
|
527
535
|
assert_equal false, cookie.httponly?
|
528
536
|
when 'Quux'
|
529
537
|
assert_equal 'Foo#Quux', cookie.value
|
@@ -656,6 +664,34 @@ module TestHTTPCookieJar
|
|
656
664
|
assert_equal(0, @jar.cookies(url).length)
|
657
665
|
end
|
658
666
|
|
667
|
+
def test_non_rfc3986_compliant_paths
|
668
|
+
url = HTTP::Cookie::URIParser.parse('http://RubyForge.org/login[]')
|
669
|
+
|
670
|
+
values = cookie_values(:path => "/login[]", :expires => nil, :origin => url)
|
671
|
+
|
672
|
+
# Add one cookie with an expiration date in the future
|
673
|
+
cookie = HTTP::Cookie.new(values)
|
674
|
+
@jar.add(cookie)
|
675
|
+
assert_equal(1, @jar.cookies(url).length)
|
676
|
+
|
677
|
+
# Add a second cookie
|
678
|
+
@jar.add(HTTP::Cookie.new(values.merge( :name => 'Baz' )))
|
679
|
+
assert_equal(2, @jar.cookies(url).length)
|
680
|
+
|
681
|
+
# Make sure we don't get the cookie in a different path
|
682
|
+
assert_equal(0, @jar.cookies(HTTP::Cookie::URIParser.parse('http://RubyForge.org/hello[]')).length)
|
683
|
+
assert_equal(0, @jar.cookies(HTTP::Cookie::URIParser.parse('http://RubyForge.org/')).length)
|
684
|
+
|
685
|
+
# Expire the first cookie
|
686
|
+
@jar.add(HTTP::Cookie.new(values.merge( :expires => Time.now - (10 * 86400))))
|
687
|
+
assert_equal(1, @jar.cookies(url).length)
|
688
|
+
|
689
|
+
# Expire the second cookie
|
690
|
+
@jar.add(HTTP::Cookie.new(values.merge( :name => 'Baz',
|
691
|
+
:expires => Time.now - (10 * 86400))))
|
692
|
+
assert_equal(0, @jar.cookies(url).length)
|
693
|
+
end
|
694
|
+
|
659
695
|
def test_ssl_cookies
|
660
696
|
# thanks to michal "ocher" ochman for reporting the bug responsible for this test.
|
661
697
|
values = cookie_values(:expires => nil)
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-cookie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
8
8
|
- Aaron Patterson
|
9
9
|
- Eric Hodel
|
10
10
|
- Mike Dalessio
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2024-06-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: domain_name
|
@@ -127,6 +127,7 @@ extra_rdoc_files:
|
|
127
127
|
- README.md
|
128
128
|
- LICENSE.txt
|
129
129
|
files:
|
130
|
+
- ".github/CODEOWNERS"
|
130
131
|
- ".github/workflows/ci.yml"
|
131
132
|
- ".gitignore"
|
132
133
|
- CHANGELOG.md
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- lib/http/cookie.rb
|
140
141
|
- lib/http/cookie/ruby_compat.rb
|
141
142
|
- lib/http/cookie/scanner.rb
|
143
|
+
- lib/http/cookie/uri_parser.rb
|
142
144
|
- lib/http/cookie/version.rb
|
143
145
|
- lib/http/cookie_jar.rb
|
144
146
|
- lib/http/cookie_jar/abstract_saver.rb
|
@@ -156,7 +158,7 @@ homepage: https://github.com/sparklemotion/http-cookie
|
|
156
158
|
licenses:
|
157
159
|
- MIT
|
158
160
|
metadata: {}
|
159
|
-
post_install_message:
|
161
|
+
post_install_message:
|
160
162
|
rdoc_options: []
|
161
163
|
require_paths:
|
162
164
|
- lib
|
@@ -171,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
173
|
- !ruby/object:Gem::Version
|
172
174
|
version: '0'
|
173
175
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
175
|
-
signing_key:
|
176
|
+
rubygems_version: 3.5.9
|
177
|
+
signing_key:
|
176
178
|
specification_version: 4
|
177
179
|
summary: A Ruby library to handle HTTP Cookies based on RFC 6265
|
178
180
|
test_files:
|