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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c40df3f0c699e99b0f45c3af71e19e5461878bddecf1a8a28a4125965cc05c9
4
- data.tar.gz: 58dfdd11e0a9b119f5e84bdb24e8d2d28145e91d7a8fa3d5d3067572d1c2980e
3
+ metadata.gz: 1e27b1c078a2a7afaf0787772a0c48086fc5b6a108f04a87e64ed247f26e7f3d
4
+ data.tar.gz: a26e38a5eece61435947e558db362d706299a5c48ac64bad54012a52dc0850c1
5
5
  SHA512:
6
- metadata.gz: 0610a598b694dfa3a147257e160dfbfafcde951715ff7329f489b22e097490e2999f84a8401ef6019183f30fbbdbe01c31c4daf7dd9abcab34402add0a1f96bc
7
- data.tar.gz: b3a19ba49afe90cd32aba42046ec57af147bb1a12f7087102fed03e5520c30cc33fecc41785a226cf7a5680298adcb59ea2b14a9bcd6950db3b2148109a070be
6
+ metadata.gz: 6234e7a39672c501cdfb69fbbdd620c9ca7ca4c9978a714f2b0e2425d80a2dd67c111837e30a72c375a8d308ae7dae02a60ddd2d6981ed342f70ec8db8a0ba27
7
+ data.tar.gz: a2e8a89a8a226dc0ec9a15ceca62055705bd7903a4939907b17f4b6f23f1d3dda5bf5801308dda797348410bed6481961139462e87c535de7559efaf393f779f
@@ -1,5 +1,5 @@
1
1
  module HTTP
2
2
  module Negotiate
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -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.gsub(/\s+/, '')
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.split(/,+/).map do |c|
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(/=+/, 2)
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.0
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: 2023-08-23 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler