http-negotiate 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http/negotiate/version.rb +1 -1
- data/lib/http/negotiate.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e27b1c078a2a7afaf0787772a0c48086fc5b6a108f04a87e64ed247f26e7f3d
|
4
|
+
data.tar.gz: a26e38a5eece61435947e558db362d706299a5c48ac64bad54012a52dc0850c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6234e7a39672c501cdfb69fbbdd620c9ca7ca4c9978a714f2b0e2425d80a2dd67c111837e30a72c375a8d308ae7dae02a60ddd2d6981ed342f70ec8db8a0ba27
|
7
|
+
data.tar.gz: a2e8a89a8a226dc0ec9a15ceca62055705bd7903a4939907b17f4b6f23f1d3dda5bf5801308dda797348410bed6481961139462e87c535de7559efaf393f779f
|
data/lib/http/negotiate.rb
CHANGED
@@ -55,18 +55,19 @@ module HTTP::Negotiate
|
|
55
55
|
# theoretically you can have quoted-string parameter values
|
56
56
|
# but we don't care (although interestingly according to rfc7231,
|
57
57
|
# accept-language only affords q= and not arbitrary parameters)
|
58
|
-
hdr = hdr.dup.
|
58
|
+
hdr = hdr.respond_to?(:to_a) ? hdr.to_a.dup : hdr.to_s.split(/\s*,+\s*/)
|
59
|
+
hdr = hdr.map { |h| h.to_s.gsub(/\s+/, '') }.reject(&:empty?)
|
59
60
|
|
60
61
|
# don't add the test group if it's an empty string, because
|
61
62
|
# postel's law is a thing
|
62
63
|
next if hdr.empty?
|
63
64
|
|
64
|
-
accept[k] = hdr.
|
65
|
+
accept[k] = hdr.map do |c|
|
65
66
|
val, *params = c.split(/;+/)
|
66
67
|
params = params.map do |p|
|
67
|
-
k, v = p.split(
|
68
|
+
k, v = p.split(/\s*=+\s*/, 2)
|
68
69
|
k = k.downcase.to_sym
|
69
|
-
v = v.to_f if v and k == :q
|
70
|
+
v = v.to_f if v and k == :q # note garbage will return 0
|
70
71
|
[k, v]
|
71
72
|
end.to_h
|
72
73
|
if params[:q]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-negotiate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|