http-accept 2.2.0 → 2.2.2
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
- checksums.yaml.gz.sig +0 -0
- data/lib/http/accept/charsets.rb +12 -28
- data/lib/http/accept/content_type.rb +6 -23
- data/lib/http/accept/encodings.rb +12 -28
- data/lib/http/accept/languages.rb +9 -25
- data/lib/http/accept/media_types/map.rb +8 -25
- data/lib/http/accept/media_types.rb +12 -29
- data/lib/http/accept/parse_error.rb +3 -20
- data/lib/http/accept/quoted_string.rb +5 -22
- data/lib/http/accept/sort.rb +3 -20
- data/lib/http/accept/version.rb +4 -21
- data/lib/http/accept.rb +10 -25
- data/license.md +29 -0
- data/readme.md +150 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +39 -78
- metadata.gz.sig +0 -0
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55c9347ea971eed49f0ec9cf1e3734484a732b62fbdda2ee6bd294d17e561de5
|
|
4
|
+
data.tar.gz: 1cbaa083113de33ac60ac3a5bbac7efddc81742a550b7d3dfbd8b09bd200e591
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ebfbfc9153ec3e5778831a8ac9dabc5fcd1c95be9172eb56a3e4b98a1ebe232c5b9796b04d778e2f574b4eaddc41f3b0c98e1dd95348d17cf574401fc0a408db
|
|
7
|
+
data.tar.gz: 9d0b5bec0305a944d99111d8dcaa49ba1355101f1c7a9cddca66a606ed7bbabfb3132b4d338434a272e05ffcf547f4aaf04af8aeeade30ca1803599522f994ae
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/http/accept/charsets.rb
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2016, Matthew Kerwin <matthew@kerwin.net.au>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016, by Matthew Kerwin.
|
|
5
|
+
# Copyright, 2017-2024, by Samuel Williams.
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
require_relative
|
|
7
|
+
require "strscan"
|
|
8
|
+
|
|
9
|
+
require_relative "parse_error"
|
|
10
|
+
require_relative "quoted_string"
|
|
11
|
+
require_relative "sort"
|
|
28
12
|
|
|
29
13
|
module HTTP
|
|
30
14
|
module Accept
|
|
@@ -50,7 +34,7 @@ module HTTP
|
|
|
50
34
|
break unless scanner.scan(/\s*,\s*/)
|
|
51
35
|
end
|
|
52
36
|
|
|
53
|
-
raise ParseError.new(
|
|
37
|
+
raise ParseError.new("Could not parse entire string!") unless scanner.eos?
|
|
54
38
|
end
|
|
55
39
|
end
|
|
56
40
|
|
|
@@ -62,8 +46,8 @@ module HTTP
|
|
|
62
46
|
return Sort.by_quality_factor(charsets)
|
|
63
47
|
end
|
|
64
48
|
|
|
65
|
-
HTTP_ACCEPT_CHARSET =
|
|
66
|
-
WILDCARD_CHARSET = Charset.new(
|
|
49
|
+
HTTP_ACCEPT_CHARSET = "HTTP_ACCEPT_CHARSET".freeze
|
|
50
|
+
WILDCARD_CHARSET = Charset.new("*", nil).freeze
|
|
67
51
|
|
|
68
52
|
# Parse the list of browser preferred charsets and return ordered by priority.
|
|
69
53
|
def self.browser_preferred_charsets(env)
|
|
@@ -74,7 +58,7 @@ module HTTP
|
|
|
74
58
|
# Accept-Charset = 1#( ( charset / "*" ) [ weight ] )
|
|
75
59
|
#
|
|
76
60
|
# Because of the `1#` rule, an empty header value is not considered valid.
|
|
77
|
-
raise ParseError.new(
|
|
61
|
+
raise ParseError.new("Could not parse entire string!")
|
|
78
62
|
else
|
|
79
63
|
return HTTP::Accept::Charsets.parse(accept_charsets)
|
|
80
64
|
end
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require_relative "media_types"
|
|
7
|
+
require_relative "quoted_string"
|
|
25
8
|
|
|
26
9
|
module HTTP
|
|
27
10
|
module Accept
|
|
@@ -29,7 +12,7 @@ module HTTP
|
|
|
29
12
|
class ContentType < MediaTypes::MediaRange
|
|
30
13
|
def initialize(type, subtype, parameters = {})
|
|
31
14
|
# We do some basic validation here:
|
|
32
|
-
raise ArgumentError.new("#{self.class} can not have wildcards: #{type}", "#{subtype}") if type.include?(
|
|
15
|
+
raise ArgumentError.new("#{self.class} can not have wildcards: #{type}", "#{subtype}") if type.include?("*") || subtype.include?("*")
|
|
33
16
|
|
|
34
17
|
super
|
|
35
18
|
end
|
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2016, Matthew Kerwin <matthew@kerwin.net.au>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016, by Matthew Kerwin.
|
|
5
|
+
# Copyright, 2017-2024, by Samuel Williams.
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
require_relative
|
|
7
|
+
require "strscan"
|
|
8
|
+
|
|
9
|
+
require_relative "parse_error"
|
|
10
|
+
require_relative "quoted_string"
|
|
11
|
+
require_relative "sort"
|
|
28
12
|
|
|
29
13
|
module HTTP
|
|
30
14
|
module Accept
|
|
@@ -52,7 +36,7 @@ module HTTP
|
|
|
52
36
|
break unless scanner.scan(/\s*,\s*/)
|
|
53
37
|
end
|
|
54
38
|
|
|
55
|
-
raise ParseError.new(
|
|
39
|
+
raise ParseError.new("Could not parse entire string!") unless scanner.eos?
|
|
56
40
|
end
|
|
57
41
|
end
|
|
58
42
|
|
|
@@ -64,9 +48,9 @@ module HTTP
|
|
|
64
48
|
return Sort.by_quality_factor(encodings)
|
|
65
49
|
end
|
|
66
50
|
|
|
67
|
-
HTTP_ACCEPT_ENCODING =
|
|
68
|
-
WILDCARD_CONTENT_CODING = ContentCoding.new(
|
|
69
|
-
IDENTITY_CONTENT_CODING = ContentCoding.new(
|
|
51
|
+
HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING".freeze
|
|
52
|
+
WILDCARD_CONTENT_CODING = ContentCoding.new("*", nil).freeze
|
|
53
|
+
IDENTITY_CONTENT_CODING = ContentCoding.new("identity", nil).freeze
|
|
70
54
|
|
|
71
55
|
# Parse the list of browser preferred content codings and return ordered by priority. If no
|
|
72
56
|
# `Accept-Encoding:` header is specified, the behaviour is the same as if
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
5
|
+
# Copyright, 2021, by Khaled Hassan Hussein.
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
require "strscan"
|
|
8
|
+
|
|
9
|
+
require_relative "parse_error"
|
|
10
|
+
require_relative "sort"
|
|
27
11
|
|
|
28
12
|
module HTTP
|
|
29
13
|
module Accept
|
|
@@ -40,10 +24,10 @@ module HTTP
|
|
|
40
24
|
# Provides an efficient data-structure for matching the Accept-Languages header to set of available locales according to https://tools.ietf.org/html/rfc7231#section-5.3.5 and https://tools.ietf.org/html/rfc4647#section-2.3
|
|
41
25
|
class Locales
|
|
42
26
|
def self.expand(locale, into)
|
|
43
|
-
parts = locale.split(
|
|
27
|
+
parts = locale.split("-")
|
|
44
28
|
|
|
45
29
|
while parts.size > 0
|
|
46
|
-
key = parts.join(
|
|
30
|
+
key = parts.join("-")
|
|
47
31
|
|
|
48
32
|
into[key] ||= locale
|
|
49
33
|
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module HTTP
|
|
24
7
|
module Accept
|
|
@@ -44,8 +27,8 @@ module HTTP
|
|
|
44
27
|
def for(media_types)
|
|
45
28
|
media_types.each do |media_range|
|
|
46
29
|
mime_type = case media_range
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
when String then media_range
|
|
31
|
+
else media_range.mime_type
|
|
49
32
|
end
|
|
50
33
|
|
|
51
34
|
if object = @media_types[mime_type]
|
|
@@ -66,15 +49,15 @@ module HTTP
|
|
|
66
49
|
|
|
67
50
|
# Add a converter to the collection. A converter can be anything that responds to #content_type. Objects will be considered in the order they are added, subsequent objects cannot override previously defined media types. `object` must respond to #split('/', 2) which should give the type and subtype.
|
|
68
51
|
def << object
|
|
69
|
-
type, subtype = object.split(
|
|
52
|
+
type, subtype = object.split("/", 2)
|
|
70
53
|
|
|
71
54
|
# We set the default if not specified already:
|
|
72
55
|
@media_types[WILDCARD] = object if @media_types.empty?
|
|
73
56
|
|
|
74
|
-
if type !=
|
|
57
|
+
if type != "*"
|
|
75
58
|
@media_types["#{type}/*"] ||= object
|
|
76
59
|
|
|
77
|
-
if subtype !=
|
|
60
|
+
if subtype != "*"
|
|
78
61
|
@media_types["#{type}/#{subtype}"] ||= object
|
|
79
62
|
end
|
|
80
63
|
end
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
24
5
|
|
|
25
|
-
|
|
26
|
-
require_relative 'quoted_string'
|
|
27
|
-
require_relative 'sort'
|
|
6
|
+
require "strscan"
|
|
28
7
|
|
|
29
|
-
require_relative
|
|
8
|
+
require_relative "parse_error"
|
|
9
|
+
require_relative "quoted_string"
|
|
10
|
+
require_relative "sort"
|
|
11
|
+
|
|
12
|
+
require_relative "media_types/map"
|
|
30
13
|
|
|
31
14
|
module HTTP
|
|
32
15
|
module Accept
|
|
@@ -38,12 +21,12 @@ module HTTP
|
|
|
38
21
|
|
|
39
22
|
# A single entry in the Accept: header, which includes a mime type and associated parameters.
|
|
40
23
|
MediaRange = Struct.new(:type, :subtype, :parameters) do
|
|
41
|
-
def initialize(type, subtype =
|
|
24
|
+
def initialize(type, subtype = "*", parameters = {})
|
|
42
25
|
super(type, subtype, parameters)
|
|
43
26
|
end
|
|
44
27
|
|
|
45
28
|
def parameters_string
|
|
46
|
-
return
|
|
29
|
+
return "" if parameters == nil or parameters.empty?
|
|
47
30
|
|
|
48
31
|
parameters.collect do |key, value|
|
|
49
32
|
"; #{key.to_s}=#{QuotedString.quote(value.to_s)}"
|
|
@@ -69,7 +52,7 @@ module HTTP
|
|
|
69
52
|
alias to_str to_s
|
|
70
53
|
|
|
71
54
|
def quality_factor
|
|
72
|
-
parameters.fetch(
|
|
55
|
+
parameters.fetch("q", 1.0).to_f
|
|
73
56
|
end
|
|
74
57
|
|
|
75
58
|
def split(*args)
|
|
@@ -120,7 +103,7 @@ module HTTP
|
|
|
120
103
|
return Sort.by_quality_factor(media_types)
|
|
121
104
|
end
|
|
122
105
|
|
|
123
|
-
HTTP_ACCEPT =
|
|
106
|
+
HTTP_ACCEPT = "HTTP_ACCEPT".freeze
|
|
124
107
|
WILDCARD_MEDIA_RANGE = MediaRange.new("*", "*", {}).freeze
|
|
125
108
|
|
|
126
109
|
# Parse the list of browser preferred content types and return ordered by priority. If no `Accept:` header is specified, the behaviour is the same as if `Accept: */*` was provided (according to RFC).
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module HTTP
|
|
24
7
|
module Accept
|
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module HTTP
|
|
24
7
|
module Accept
|
|
25
8
|
# According to https://tools.ietf.org/html/rfc7231#appendix-C
|
|
26
9
|
TOKEN = /[!#$%&'*+\-.^_`|~0-9A-Z]+/i
|
|
27
|
-
QUOTED_STRING = /"(
|
|
10
|
+
QUOTED_STRING = /"(?:[^"\\\r\n]|\\.)*"/
|
|
28
11
|
|
|
29
12
|
module QuotedString
|
|
30
13
|
# Unquote a "quoted-string" value according to https://tools.ietf.org/html/rfc7230#section-3.2.6
|
|
@@ -36,7 +19,7 @@ module HTTP
|
|
|
36
19
|
|
|
37
20
|
if normalize_whitespace
|
|
38
21
|
# LWS = [CRLF] 1*( SP | HT )
|
|
39
|
-
value.gsub!(/[\r\n]+\s+/,
|
|
22
|
+
value.gsub!(/[\r\n]+\s+/, " ")
|
|
40
23
|
end
|
|
41
24
|
|
|
42
25
|
return value
|
data/lib/http/accept/sort.rb
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module HTTP
|
|
24
7
|
module Accept
|
data/lib/http/accept/version.rb
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module HTTP
|
|
24
7
|
module Accept
|
|
25
|
-
VERSION = "2.2.
|
|
8
|
+
VERSION = "2.2.2"
|
|
26
9
|
end
|
|
27
10
|
end
|
data/lib/http/accept.rb
CHANGED
|
@@ -1,36 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
|
5
|
+
# Copyright, 2016, by Matthew Kerwin.
|
|
6
|
+
# Copyright, 2017, by Andy Brody.
|
|
7
|
+
|
|
8
|
+
require_relative "accept/version"
|
|
24
9
|
|
|
25
10
|
# Accept: header
|
|
26
|
-
require_relative
|
|
27
|
-
require_relative
|
|
11
|
+
require_relative "accept/media_types"
|
|
12
|
+
require_relative "accept/content_type"
|
|
28
13
|
|
|
29
14
|
# Accept-Encoding: header
|
|
30
|
-
require_relative
|
|
15
|
+
require_relative "accept/encodings"
|
|
31
16
|
|
|
32
17
|
# Accept-Language: header
|
|
33
|
-
require_relative
|
|
18
|
+
require_relative "accept/languages"
|
|
34
19
|
|
|
35
20
|
module HTTP
|
|
36
21
|
module Accept
|
data/license.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright, 2016-2024, by Samuel Williams.
|
|
4
|
+
Copyright, 2016, by Matthew Kerwin.
|
|
5
|
+
Copyright, 2016, by Alif Rachmawadi.
|
|
6
|
+
Copyright, 2017, by Andy Brody.
|
|
7
|
+
Copyright, 2019, by Robert Pritzkow.
|
|
8
|
+
Copyright, 2020, by Olle Jonsson.
|
|
9
|
+
Copyright, 2021, by Khaled Hassan Hussein.
|
|
10
|
+
Copyright, 2022, by Ian Oxley.
|
|
11
|
+
Copyright, 2025, by Alexis Bernard.
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
data/readme.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# HTTP::Accept
|
|
2
|
+
|
|
3
|
+
Provides a robust set of parsers for dealing with HTTP `Accept`, `Accept-Language`, `Accept-Encoding`, `Accept-Charset` headers.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/socketry/http-accept/actions?workflow=Test)
|
|
6
|
+
|
|
7
|
+
## Motivation
|
|
8
|
+
|
|
9
|
+
I've been [developing some tools for building RESTful endpoints](https://github.com/ioquatix/utopia/blob/master/lib/utopia/controller/respond.rb) and part of that involved versioning. After reviewing the options, I settled on using the `Accept: application/json;version=1` method [as outlined here](http://labs.qandidate.com/blog/2014/10/16/using-the-accept-header-to-version-your-api/).
|
|
10
|
+
|
|
11
|
+
The `version=1` part of the `media-type` is a `parameter` as defined by [RFC7231 Section 3.1.1.1](https://tools.ietf.org/html/rfc7231#section-3.1.1.1). After reviewing several existing different options for parsing the `Accept:` header, I noticed a disturbing trend: `header.split(',')`. Because parameters may contain quoted strings which contain commas, this is clearly not an appropriate way to parse the header.
|
|
12
|
+
|
|
13
|
+
I am concerned about correctness, security and performance. As such, I implemented this gem to provide a simple high level interface for both parsing and correctly interpreting these headers.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
``` ruby
|
|
20
|
+
gem "http-accept"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
And then execute:
|
|
24
|
+
|
|
25
|
+
$ bundle
|
|
26
|
+
|
|
27
|
+
Or install it yourself as:
|
|
28
|
+
|
|
29
|
+
$ gem install http-accept
|
|
30
|
+
|
|
31
|
+
You can then require it in your code like so:
|
|
32
|
+
|
|
33
|
+
``` ruby
|
|
34
|
+
require "http/accept"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Please see the [project documentation](https://github.com/ioquatix/http-accept) for more details.
|
|
40
|
+
|
|
41
|
+
### Parsing Accept: headers
|
|
42
|
+
|
|
43
|
+
You can parse the incoming `Accept:` header:
|
|
44
|
+
|
|
45
|
+
``` ruby
|
|
46
|
+
media_types = HTTP::Accept::MediaTypes.parse("text/html;q=0.5, application/json; version=1")
|
|
47
|
+
|
|
48
|
+
expect(media_types[0].mime_type).to be == "application/json"
|
|
49
|
+
expect(media_types[0].parameters).to be == {"version" => "1"}
|
|
50
|
+
expect(media_types[1].mime_type).to be == "text/html"
|
|
51
|
+
expect(media_types[1].parameters).to be == {"q" => "0.5"}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Normally, you'd want to match the media types against some set of available mime types:
|
|
55
|
+
|
|
56
|
+
``` ruby
|
|
57
|
+
module ToJSON
|
|
58
|
+
def content_type
|
|
59
|
+
HTTP::Accept::ContentType.new("application", "json", charset: "utf-8")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Used for inserting into map.
|
|
63
|
+
def split(*args)
|
|
64
|
+
content_type.split(*args)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def convert(object, options)
|
|
68
|
+
object.to_json
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
module ToXML
|
|
73
|
+
# Are you kidding?
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
map = HTTP::Accept::MediaTypes::Map.new
|
|
77
|
+
map << ToJSON
|
|
78
|
+
map << ToXML
|
|
79
|
+
|
|
80
|
+
object, media_range = map.for(media_types)
|
|
81
|
+
content = object.convert(model, media_range.parameters)
|
|
82
|
+
response = [200, {"Content-Type" => object.content_type}, [content]]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Parsing Accept-Language: headers
|
|
86
|
+
|
|
87
|
+
You can parse the incoming `Accept-Language:` header:
|
|
88
|
+
|
|
89
|
+
``` ruby
|
|
90
|
+
languages = HTTP::Accept::Languages.parse("da, en-gb;q=0.8, en;q=0.7")
|
|
91
|
+
|
|
92
|
+
expect(languages[0].locale).to be == "da"
|
|
93
|
+
expect(languages[1].locale).to be == "en-gb"
|
|
94
|
+
expect(languages[2].locale).to be == "en"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Normally, you'd want to match the languages against some set of available localizations:
|
|
98
|
+
|
|
99
|
+
``` ruby
|
|
100
|
+
available_localizations = HTTP::Accept::Languages::Locales.new(["en-nz", "en-us"])
|
|
101
|
+
|
|
102
|
+
# Given the languages that the user wants, and the localizations available, compute the set of desired localizations.
|
|
103
|
+
desired_localizations = available_localizations & languages
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The `desired_localizations` in the example above is a subset of `available_localizations`.
|
|
107
|
+
|
|
108
|
+
`HTTP::Accept::Languages::Locales` provides an efficient data-structure for matching the Accept-Languages header to set of available localizations according to <https://tools.ietf.org/html/rfc7231#section-5.3.5> and <https://tools.ietf.org/html/rfc4647#section-2.3>
|
|
109
|
+
|
|
110
|
+
## Releases
|
|
111
|
+
|
|
112
|
+
Please see the [project releases](https://github.com/ioquatix/http-acceptreleases/index) for all releases.
|
|
113
|
+
|
|
114
|
+
### v2.2.2
|
|
115
|
+
|
|
116
|
+
- Fix handling of quoted strings.
|
|
117
|
+
|
|
118
|
+
## Contributing
|
|
119
|
+
|
|
120
|
+
We welcome contributions to this project.
|
|
121
|
+
|
|
122
|
+
1. Fork the repository.
|
|
123
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
|
124
|
+
3. Commit your changes (`git commit -am 'Add some feature.'`).
|
|
125
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
|
126
|
+
5. Create a new pull request.
|
|
127
|
+
|
|
128
|
+
### Running Tests
|
|
129
|
+
|
|
130
|
+
To run the test suite:
|
|
131
|
+
|
|
132
|
+
``` bash
|
|
133
|
+
$ bundle exec sus
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Making Releases
|
|
137
|
+
|
|
138
|
+
To make a new release:
|
|
139
|
+
|
|
140
|
+
``` bash
|
|
141
|
+
$ bundle exec bake gem:release:patch # or minor or major
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Developer Certificate of Origin
|
|
145
|
+
|
|
146
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
|
147
|
+
|
|
148
|
+
### Community Guidelines
|
|
149
|
+
|
|
150
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data/releases.md
ADDED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,98 +1,55 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http-accept
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
|
+
- Alexis Bernard
|
|
8
9
|
- Matthew Kerwin
|
|
9
10
|
- Alif Rachmawadi
|
|
10
11
|
- Andy Brody
|
|
12
|
+
- Ian Oxley
|
|
11
13
|
- Khaled Hassan Hussein
|
|
12
14
|
- Olle Jonsson
|
|
13
15
|
- Robert Pritzkow
|
|
14
|
-
autorequire:
|
|
15
16
|
bindir: bin
|
|
16
17
|
cert_chain:
|
|
17
18
|
- |
|
|
18
19
|
-----BEGIN CERTIFICATE-----
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
|
21
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
|
22
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
|
23
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
|
24
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
|
25
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
|
26
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
|
27
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
|
28
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
|
29
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
|
30
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
|
31
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
|
32
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
|
33
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
|
34
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
35
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
|
36
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
|
37
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
|
38
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
|
39
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
|
40
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
|
41
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
|
42
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
|
43
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
|
44
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
45
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
44
46
|
-----END CERTIFICATE-----
|
|
45
|
-
date:
|
|
46
|
-
dependencies:
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: bundler
|
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
|
-
type: :development
|
|
55
|
-
prerelease: false
|
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0'
|
|
61
|
-
- !ruby/object:Gem::Dependency
|
|
62
|
-
name: covered
|
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0'
|
|
68
|
-
type: :development
|
|
69
|
-
prerelease: false
|
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - ">="
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '0'
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: rspec
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '3.0'
|
|
82
|
-
type: :development
|
|
83
|
-
prerelease: false
|
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - "~>"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '3.0'
|
|
89
|
-
description:
|
|
90
|
-
email:
|
|
47
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
48
|
+
dependencies: []
|
|
91
49
|
executables: []
|
|
92
50
|
extensions: []
|
|
93
51
|
extra_rdoc_files: []
|
|
94
52
|
files:
|
|
95
|
-
- lib/.DS_Store
|
|
96
53
|
- lib/http/accept.rb
|
|
97
54
|
- lib/http/accept/charsets.rb
|
|
98
55
|
- lib/http/accept/content_type.rb
|
|
@@ -104,12 +61,17 @@ files:
|
|
|
104
61
|
- lib/http/accept/quoted_string.rb
|
|
105
62
|
- lib/http/accept/sort.rb
|
|
106
63
|
- lib/http/accept/version.rb
|
|
64
|
+
- license.md
|
|
65
|
+
- readme.md
|
|
66
|
+
- releases.md
|
|
107
67
|
homepage: https://github.com/ioquatix/http-accept
|
|
108
68
|
licenses:
|
|
109
69
|
- MIT
|
|
110
70
|
metadata:
|
|
71
|
+
bug_tracker_uri: https://github.com/ioquatix/http-accept/issues
|
|
72
|
+
changelog_uri: https://github.com/ioquatix/http-accept/blob/main/releases.md
|
|
111
73
|
funding_uri: https://github.com/sponsors/ioquatix/
|
|
112
|
-
|
|
74
|
+
source_code_uri: https://github.com/ioquatix/http-accept.git
|
|
113
75
|
rdoc_options: []
|
|
114
76
|
require_paths:
|
|
115
77
|
- lib
|
|
@@ -117,15 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
117
79
|
requirements:
|
|
118
80
|
- - ">="
|
|
119
81
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '
|
|
82
|
+
version: '3.3'
|
|
121
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
84
|
requirements:
|
|
123
85
|
- - ">="
|
|
124
86
|
- !ruby/object:Gem::Version
|
|
125
87
|
version: '0'
|
|
126
88
|
requirements: []
|
|
127
|
-
rubygems_version:
|
|
128
|
-
signing_key:
|
|
89
|
+
rubygems_version: 4.0.10
|
|
129
90
|
specification_version: 4
|
|
130
91
|
summary: Parse Accept and Accept-Language HTTP headers.
|
|
131
92
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/lib/.DS_Store
DELETED
|
Binary file
|