http-cookie 1.1.0 → 1.1.1
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 +7 -0
- data/LICENSE.txt +1 -1
- data/lib/http/cookie/version.rb +1 -1
- data/lib/http/cookie.rb +2 -5
- data/lib/http/cookie_jar/abstract_saver.rb +11 -22
- data/lib/http/cookie_jar/abstract_store.rb +14 -19
- data/lib/http/cookie_jar/cookiestxt_saver.rb +0 -1
- data/lib/http/cookie_jar/hash_store.rb +0 -1
- data/lib/http/cookie_jar/mozilla_store.rb +1 -2
- data/lib/http/cookie_jar/yaml_saver.rb +5 -11
- data/lib/http/cookie_jar.rb +3 -21
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 969f67e57846abc8cdb185d5a94581d1e3a71e136955d2528ef302b1bff35b7b
|
|
4
|
+
data.tar.gz: e79b8cb800e9726fcfed81bbdbe66a0cdced64809b0deec305015d5564e40c5e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1ddeeba22838c75e9638ac9b04f5cf98d985917ff9066ae79f77e91a6a08725ae27ad45de84f6c6bdd49117798572a7703ee871097124901ae008b5a899f6b5
|
|
7
|
+
data.tar.gz: 37b3457fcd0722b7db58deff7a4ca937ddac0be7ced0f5c4efc46cd6e706be66473995b13288d881c688d3d050da9140cb9952be6fc92c09b281f611d563f5f0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 1.1.1 (2026-04-06)
|
|
2
|
+
|
|
3
|
+
- Fix thread-unsafe runtime requires. (#43 by @brasic, #57)
|
|
4
|
+
- Replace `require 'cgi'` with `require 'cgi/escape'` to suppress Ruby 4.0 warning. (#56 by @dominion525)
|
|
5
|
+
- Do not define `MozillaStore` on JRuby; leave the constant undefined instead.
|
|
6
|
+
|
|
7
|
+
|
|
1
8
|
## 1.1.0 (2025-09-26)
|
|
2
9
|
|
|
3
10
|
- Implement `Cookie#to_h`. (#55) @luke-hill @flavorjones
|
data/LICENSE.txt
CHANGED
data/lib/http/cookie/version.rb
CHANGED
data/lib/http/cookie.rb
CHANGED
|
@@ -6,11 +6,8 @@ require 'time'
|
|
|
6
6
|
require 'uri'
|
|
7
7
|
require 'domain_name'
|
|
8
8
|
require 'http/cookie/ruby_compat'
|
|
9
|
-
require 'cgi'
|
|
10
|
-
|
|
11
|
-
module HTTP
|
|
12
|
-
autoload :CookieJar, 'http/cookie_jar'
|
|
13
|
-
end
|
|
9
|
+
require 'cgi/escape'
|
|
10
|
+
require 'http/cookie_jar'
|
|
14
11
|
|
|
15
12
|
# This class is used to represent an HTTP Cookie.
|
|
16
13
|
class HTTP::Cookie
|
|
@@ -2,29 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# An abstract superclass for all saver classes.
|
|
4
4
|
class HTTP::CookieJar::AbstractSaver
|
|
5
|
-
class << self
|
|
6
|
-
@@class_map = {}
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@@class_map.fetch(symbol)
|
|
17
|
-
rescue LoadError, IndexError
|
|
18
|
-
raise IndexError, 'cookie saver unavailable: %s' % symbol.inspect
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def inherited(subclass) # :nodoc:
|
|
23
|
-
@@class_map[class_to_symbol(subclass)] = subclass
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def class_to_symbol(klass) # :nodoc:
|
|
27
|
-
klass.name[/[^:]+?(?=Saver$|$)/].downcase.to_sym
|
|
6
|
+
def self.implementation(symbol)
|
|
7
|
+
case symbol
|
|
8
|
+
when :yaml
|
|
9
|
+
HTTP::CookieJar::YAMLSaver
|
|
10
|
+
when :cookiestxt
|
|
11
|
+
HTTP::CookieJar::CookiestxtSaver
|
|
12
|
+
else
|
|
13
|
+
raise IndexError, 'cookie saver unavailable: %s' % symbol.inspect
|
|
28
14
|
end
|
|
29
15
|
end
|
|
30
16
|
|
|
@@ -63,3 +49,6 @@ class HTTP::CookieJar::AbstractSaver
|
|
|
63
49
|
# self
|
|
64
50
|
end
|
|
65
51
|
end
|
|
52
|
+
|
|
53
|
+
require "http/cookie_jar/yaml_saver"
|
|
54
|
+
require "http/cookie_jar/cookiestxt_saver"
|
|
@@ -6,29 +6,18 @@ class HTTP::CookieJar::AbstractStore
|
|
|
6
6
|
include MonitorMixin
|
|
7
7
|
|
|
8
8
|
class << self
|
|
9
|
-
@@class_map = {}
|
|
10
9
|
|
|
11
|
-
# Gets an implementation class by the name
|
|
12
|
-
# load "http/cookie_jar/*_store" if not found. If loading fails,
|
|
13
|
-
# IndexError is raised.
|
|
10
|
+
# Gets an implementation class by the name.
|
|
14
11
|
def implementation(symbol)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
raise IndexError, 'cookie store unavailable: %s
|
|
12
|
+
case symbol
|
|
13
|
+
when :hash
|
|
14
|
+
HTTP::CookieJar::HashStore
|
|
15
|
+
when :mozilla
|
|
16
|
+
HTTP::CookieJar::MozillaStore
|
|
17
|
+
else
|
|
18
|
+
raise IndexError, 'cookie store unavailable: %s' % symbol.inspect
|
|
22
19
|
end
|
|
23
20
|
end
|
|
24
|
-
|
|
25
|
-
def inherited(subclass) # :nodoc:
|
|
26
|
-
@@class_map[class_to_symbol(subclass)] = subclass
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def class_to_symbol(klass) # :nodoc:
|
|
30
|
-
klass.name[/[^:]+?(?=Store$|$)/].downcase.to_sym
|
|
31
|
-
end
|
|
32
21
|
end
|
|
33
22
|
|
|
34
23
|
# Defines options and their default values.
|
|
@@ -122,3 +111,9 @@ class HTTP::CookieJar::AbstractStore
|
|
|
122
111
|
# self
|
|
123
112
|
end
|
|
124
113
|
end
|
|
114
|
+
|
|
115
|
+
require 'http/cookie_jar/hash_store'
|
|
116
|
+
|
|
117
|
+
unless defined?(JRUBY_VERSION)
|
|
118
|
+
require 'http/cookie_jar/mozilla_store'
|
|
119
|
+
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# :markup: markdown
|
|
2
|
-
|
|
3
|
-
require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2"
|
|
4
|
-
require 'yaml'
|
|
2
|
+
autoload :YAML, 'yaml'
|
|
5
3
|
|
|
6
4
|
# YAMLSaver saves and loads cookies in the YAML format. It can load a
|
|
7
5
|
# YAML file saved by Mechanize, but the saving format is not
|
|
@@ -74,13 +72,9 @@ class HTTP::CookieJar::YAMLSaver < HTTP::CookieJar::AbstractSaver
|
|
|
74
72
|
{}
|
|
75
73
|
end
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
else
|
|
82
|
-
def load_yaml(yaml)
|
|
83
|
-
YAML.load(yaml)
|
|
84
|
-
end
|
|
75
|
+
def load_yaml(yaml)
|
|
76
|
+
YAML.safe_load(yaml, :permitted_classes => %w[Time HTTP::Cookie Mechanize::Cookie DomainName], :aliases => true)
|
|
77
|
+
rescue NoMethodError # ruby < 2.0, no safe_load
|
|
78
|
+
YAML.load(yaml)
|
|
85
79
|
end
|
|
86
80
|
end
|
data/lib/http/cookie_jar.rb
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
# :markup: markdown
|
|
2
|
-
require 'http/cookie'
|
|
3
2
|
|
|
4
3
|
##
|
|
5
4
|
# This class is used to manage the Cookies that have been returned from
|
|
6
5
|
# any particular website.
|
|
7
6
|
|
|
8
7
|
class HTTP::CookieJar
|
|
9
|
-
class << self
|
|
10
|
-
def const_missing(name)
|
|
11
|
-
case name.to_s
|
|
12
|
-
when /\A([A-Za-z]+)Store\z/
|
|
13
|
-
file = 'http/cookie_jar/%s_store' % $1.downcase
|
|
14
|
-
when /\A([A-Za-z]+)Saver\z/
|
|
15
|
-
file = 'http/cookie_jar/%s_saver' % $1.downcase
|
|
16
|
-
end
|
|
17
|
-
begin
|
|
18
|
-
require file
|
|
19
|
-
rescue LoadError
|
|
20
|
-
raise NameError, 'can\'t resolve constant %s; failed to load %s' % [name, file]
|
|
21
|
-
end
|
|
22
|
-
if const_defined?(name)
|
|
23
|
-
const_get(name)
|
|
24
|
-
else
|
|
25
|
-
raise NameError, 'can\'t resolve constant %s after loading %s' % [name, file]
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
8
|
|
|
30
9
|
attr_reader :store
|
|
31
10
|
|
|
@@ -342,3 +321,6 @@ class HTTP::CookieJar
|
|
|
342
321
|
self
|
|
343
322
|
end
|
|
344
323
|
end
|
|
324
|
+
|
|
325
|
+
require 'http/cookie_jar/abstract_store'
|
|
326
|
+
require 'http/cookie_jar/abstract_saver'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http-cookie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akinori MUSHA
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
name: sqlite3
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
|
33
|
-
- - "
|
|
33
|
+
- - ">="
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
35
|
version: '1.3'
|
|
36
36
|
type: :development
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
|
40
|
-
- - "
|
|
40
|
+
- - ">="
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
42
|
version: '1.3'
|
|
43
43
|
- !ruby/object:Gem::Dependency
|
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
161
|
version: '0'
|
|
162
162
|
requirements: []
|
|
163
|
-
rubygems_version:
|
|
163
|
+
rubygems_version: 4.0.9
|
|
164
164
|
specification_version: 4
|
|
165
165
|
summary: A Ruby library to handle HTTP Cookies based on RFC 6265
|
|
166
166
|
test_files: []
|