http-cookie 1.0.6 → 1.0.8
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/CHANGELOG.md +17 -0
- data/lib/http/cookie/version.rb +1 -1
- data/lib/http/cookie.rb +4 -1
- data/lib/http/cookie_jar/mozilla_store.rb +0 -2
- data/test/test_http_cookie.rb +15 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 143890479b8951250d5f45d4528c390e03741d943269abe0901e091b544f95ca
|
4
|
+
data.tar.gz: 7bfef9e1bd7cd6cb01f0de248717fade7a1871fb120cd35227657a96c371d384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba03e3c618d888517bc4bb9e95c08cf4c89bbe5a9ec075d31dcaba353d8864b338fe79bf7ad36f45d6e87a114eefabe41ed62a7b62876c3ba55f459e022fb24f
|
7
|
+
data.tar.gz: 846fa3243f97982df9b196fbc0645d13cd233105bbaa98e2e42b36f5a95b58c07d7571c213c6b35034b4ea41f1ce415857aabbbfe20042305611608fa3d327df
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## 1.0.8 (2024-12-05)
|
2
|
+
|
3
|
+
- `Cookie#expires=` accepts `DateTime` objects. (#52) @luke-hill @flavorjones
|
4
|
+
|
5
|
+
|
6
|
+
## 1.0.7 (2024-06-06)
|
7
|
+
|
8
|
+
- Explicitly require "cgi" to avoid `NameError` in some applications. (#50 by @flavorjones)
|
9
|
+
|
10
|
+
|
11
|
+
## 1.0.6 (2024-06-01)
|
12
|
+
|
13
|
+
- Fix error formatting bug in HTTP::CookieJar::AbstractStore (#42 by @andrelaszlo)
|
14
|
+
- Allow non-RFC 3986-compliant URLs (#45 by @c960657)
|
15
|
+
- Add coverage for Ruby 3.2 and 3.3 (#46 by @flavorjones)
|
16
|
+
- Quash ruby 3.4 warnings (#47 by @flavorjones)
|
17
|
+
|
1
18
|
## 1.0.5 (2022-05-25)
|
2
19
|
|
3
20
|
- Silence SQLite3 warnings
|
data/lib/http/cookie/version.rb
CHANGED
data/lib/http/cookie.rb
CHANGED
@@ -6,6 +6,7 @@ require 'time'
|
|
6
6
|
require 'uri'
|
7
7
|
require 'domain_name'
|
8
8
|
require 'http/cookie/ruby_compat'
|
9
|
+
require 'cgi'
|
9
10
|
|
10
11
|
module HTTP
|
11
12
|
autoload :CookieJar, 'http/cookie_jar'
|
@@ -88,7 +89,7 @@ class HTTP::Cookie
|
|
88
89
|
|
89
90
|
# The Expires attribute value as a Time object.
|
90
91
|
#
|
91
|
-
# The setter method accepts a Time object, a string representation
|
92
|
+
# The setter method accepts a Time / DateTime object, a string representation
|
92
93
|
# of date/time that Time.parse can understand, or `nil`.
|
93
94
|
#
|
94
95
|
# Setting this value resets #max_age to nil. When #max_age is
|
@@ -492,6 +493,8 @@ class HTTP::Cookie
|
|
492
493
|
def expires= t
|
493
494
|
case t
|
494
495
|
when nil, Time
|
496
|
+
when DateTime
|
497
|
+
t = t.to_time
|
495
498
|
else
|
496
499
|
t = Time.parse(t)
|
497
500
|
end
|
data/test/test_http_cookie.rb
CHANGED
@@ -717,8 +717,22 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
717
717
|
end
|
718
718
|
|
719
719
|
def test_expiration
|
720
|
-
|
720
|
+
expires = Time.now + 86400
|
721
|
+
cookie = HTTP::Cookie.new(cookie_values(expires: expires))
|
722
|
+
|
723
|
+
assert_equal(expires, cookie.expires)
|
724
|
+
assert_equal false, cookie.expired?
|
725
|
+
assert_equal true, cookie.expired?(cookie.expires + 1)
|
726
|
+
assert_equal false, cookie.expired?(cookie.expires - 1)
|
727
|
+
cookie.expire!
|
728
|
+
assert_equal true, cookie.expired?
|
729
|
+
end
|
730
|
+
|
731
|
+
def test_expiration_using_datetime
|
732
|
+
expires = DateTime.now + 1
|
733
|
+
cookie = HTTP::Cookie.new(cookie_values(expires: expires))
|
721
734
|
|
735
|
+
assert_equal(expires.to_time, cookie.expires)
|
722
736
|
assert_equal false, cookie.expired?
|
723
737
|
assert_equal true, cookie.expired?(cookie.expires + 1)
|
724
738
|
assert_equal false, cookie.expired?(cookie.expires - 1)
|
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.8
|
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: 2024-
|
14
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: domain_name
|
@@ -158,7 +158,7 @@ homepage: https://github.com/sparklemotion/http-cookie
|
|
158
158
|
licenses:
|
159
159
|
- MIT
|
160
160
|
metadata: {}
|
161
|
-
post_install_message:
|
161
|
+
post_install_message:
|
162
162
|
rdoc_options: []
|
163
163
|
require_paths:
|
164
164
|
- lib
|
@@ -173,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
|
-
rubygems_version: 3.5.
|
177
|
-
signing_key:
|
176
|
+
rubygems_version: 3.5.22
|
177
|
+
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: A Ruby library to handle HTTP Cookies based on RFC 6265
|
180
180
|
test_files:
|