protocol-http 0.22.1 → 0.22.5

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: 52e91627263ea1f1b1c1744372ca276042bc0b901b3eef0fbb45cb79e49daae8
4
- data.tar.gz: 4bbf0d84e477382c6a42551f25b73bd2adac17ea78f649490beba2b0f8462866
3
+ metadata.gz: 18e5cfb137351205caf1e8c38a22b3857b55593d75496784326918f7159e686d
4
+ data.tar.gz: a9679ae47a3313b8fcd14dc5ea5a22b93fdf1a08c8d01f03dfdb81ea8ee16338
5
5
  SHA512:
6
- metadata.gz: c07409b15f91f5b3d3fcdaccaf2410fefd0fd513c1657dde0209c1aa4001a7c4ec15fc7843c4a403a089c37f0d2952c53300961e4bb1b8fd70b3a04876c31e6a
7
- data.tar.gz: 3fb7f131549020cdfe0b79a0348fd14a8ee96f7acdbdd4f3faf9ce0781f9d48d21a006fbb2338764884795b822c7e6b0b10426a77a31d79f7110d721c1044f88
6
+ metadata.gz: f3a0305df607f355df9ad6ec5ec3db2442ced0bfd30ef792af8e1823b850a03a1f46069baf21aa52b802a31593ce11ab79fab2225016336872a7d0504b9c59e1
7
+ data.tar.gz: ca27f71e4768d5b50590e85f9dabc5003a9daa367494f29eb8ce2e742cb22907a580c1b8f3a11ec0abe946b1cb7c036cddb9eb14c46202fbcce5d3c47a31a028
@@ -32,6 +32,10 @@ module Protocol
32
32
  @directives = directives
33
33
  end
34
34
 
35
+ attr :name
36
+ attr :value
37
+ attr :directives
38
+
35
39
  def encoded_name
36
40
  URL.escape(@name)
37
41
  end
@@ -61,18 +65,25 @@ module Protocol
61
65
  return buffer
62
66
  end
63
67
 
64
- def self.parse string
65
- head, *options = string.split(/\s*;\s*/)
68
+ def self.parse(string)
69
+ head, *directives = string.split(/\s*;\s*/)
66
70
 
67
71
  key, value = head.split('=')
68
- directives.collect{|directive| directive.split('=', 2)}.to_h
72
+ directives = self.parse_directives(directives)
69
73
 
70
74
  self.new(
71
- URI.decode(key),
72
- URI.decode(value),
75
+ URL.unescape(key),
76
+ URL.unescape(value),
73
77
  directives,
74
78
  )
75
79
  end
80
+
81
+ def self.parse_directives(strings)
82
+ strings.collect do |string|
83
+ key, value = string.split('=', 2)
84
+ [key, value || true]
85
+ end.to_h
86
+ end
76
87
  end
77
88
  end
78
89
  end
@@ -21,6 +21,7 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require_relative 'multiple'
24
+ require_relative '../cookie'
24
25
 
25
26
  module Protocol
26
27
  module HTTP
@@ -40,10 +40,12 @@ module Protocol
40
40
  @app = default_app
41
41
  end
42
42
 
43
- def use(middleware, *arguments, **options, &block)
44
- @use << proc {|app| middleware.new(app, *arguments, **options, &block)}
43
+ def use(middleware, *arguments, &block)
44
+ @use << proc {|app| middleware.new(app, *arguments, &block)}
45
45
  end
46
46
 
47
+ ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)
48
+
47
49
  def run(app)
48
50
  @app = app
49
51
  end
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Protocol
24
24
  module HTTP
25
- VERSION = "0.22.1"
25
+ VERSION = "0.22.5"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.22.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-05 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.2.15
115
+ rubygems_version: 3.1.6
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Provides abstractions to handle HTTP protocols.