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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e5cfb137351205caf1e8c38a22b3857b55593d75496784326918f7159e686d
|
4
|
+
data.tar.gz: a9679ae47a3313b8fcd14dc5ea5a22b93fdf1a08c8d01f03dfdb81ea8ee16338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a0305df607f355df9ad6ec5ec3db2442ced0bfd30ef792af8e1823b850a03a1f46069baf21aa52b802a31593ce11ab79fab2225016336872a7d0504b9c59e1
|
7
|
+
data.tar.gz: ca27f71e4768d5b50590e85f9dabc5003a9daa367494f29eb8ce2e742cb22907a580c1b8f3a11ec0abe946b1cb7c036cddb9eb14c46202fbcce5d3c47a31a028
|
data/lib/protocol/http/cookie.rb
CHANGED
@@ -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
|
65
|
-
head, *
|
68
|
+
def self.parse(string)
|
69
|
+
head, *directives = string.split(/\s*;\s*/)
|
66
70
|
|
67
71
|
key, value = head.split('=')
|
68
|
-
directives
|
72
|
+
directives = self.parse_directives(directives)
|
69
73
|
|
70
74
|
self.new(
|
71
|
-
|
72
|
-
|
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
|
@@ -40,10 +40,12 @@ module Protocol
|
|
40
40
|
@app = default_app
|
41
41
|
end
|
42
42
|
|
43
|
-
def use(middleware, *arguments,
|
44
|
-
@use << proc {|app| middleware.new(app, *arguments,
|
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
|
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.
|
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-
|
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.
|
115
|
+
rubygems_version: 3.1.6
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Provides abstractions to handle HTTP protocols.
|