protocol-rack 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/rack/body/streaming.rb +26 -20
- data/lib/protocol/rack/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +20 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93f36e89bf961a77ffb20daa447e04e07d019e213d477c35383c8195f0dff9b4
|
4
|
+
data.tar.gz: cd60bb47a4d8e04b5505e339df964237efc00de093783b3179c8421c33eabcc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e25a07fa07b2e41fc19a48d331311db49ddd19f87faa26ffc523285081a64ba2fc94e9a9d480c0f86e1f78a9bc883f8e45a2239b372ada59df2e9a11682500e
|
7
|
+
data.tar.gz: a96d427f73445ee5e449ca0f80bf2bd396cc7737fc2b97fb5704143cbe5b2325a663403197cf51d807b77d89bcf62bbab36bc965241661be19a942dab08582c2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -14,41 +14,47 @@ module Protocol
|
|
14
14
|
def initialize(block, input = nil)
|
15
15
|
@block = block
|
16
16
|
@input = input
|
17
|
+
@output = nil
|
17
18
|
end
|
18
19
|
|
19
20
|
attr :block
|
20
|
-
|
21
|
-
def each(&block)
|
22
|
-
stream = ::Protocol::HTTP::Body::Stream.new(@input, Output.new(block))
|
23
|
-
|
24
|
-
@block.call(stream)
|
25
|
-
end
|
26
|
-
|
27
|
-
def stream?
|
28
|
-
true
|
29
|
-
end
|
30
|
-
|
31
|
-
def call(stream)
|
32
|
-
@block.call(stream)
|
33
|
-
end
|
34
21
|
|
35
22
|
class Output
|
36
|
-
def initialize(block)
|
37
|
-
|
23
|
+
def initialize(input, block)
|
24
|
+
stream = ::Protocol::HTTP::Body::Stream.new(input, self)
|
25
|
+
@fiber = Fiber.new do
|
26
|
+
block.call(stream)
|
27
|
+
@fiber = nil
|
28
|
+
end
|
38
29
|
end
|
39
30
|
|
40
31
|
def write(chunk)
|
41
|
-
|
32
|
+
Fiber.yield(chunk)
|
42
33
|
end
|
43
34
|
|
44
35
|
def close
|
45
|
-
@
|
36
|
+
@fiber = nil
|
46
37
|
end
|
47
38
|
|
48
|
-
def
|
49
|
-
|
39
|
+
def read
|
40
|
+
@fiber&.resume
|
50
41
|
end
|
51
42
|
end
|
43
|
+
|
44
|
+
# Invokes the block in a fiber which yields chunks when they are available.
|
45
|
+
def read
|
46
|
+
@output ||= Output.new(@input, @block)
|
47
|
+
return @output.read
|
48
|
+
end
|
49
|
+
|
50
|
+
def stream?
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
def call(stream)
|
55
|
+
raise "Streaming body has already been read!" if @output
|
56
|
+
@block.call(stream)
|
57
|
+
end
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2022-08-
|
40
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: protocol-http
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.23
|
48
|
+
version: '0.23'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.23
|
55
|
+
version: '0.23'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rack
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,72 +85,72 @@ dependencies:
|
|
85
85
|
name: bake-test
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
90
|
+
version: '0.1'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
97
|
+
version: '0.1'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: bake-test-external
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
104
|
+
version: '0.1'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
111
|
+
version: '0.1'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: covered
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
118
|
+
version: '0.16'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - "
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
125
|
+
version: '0.16'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: sus
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 0.
|
132
|
+
version: '0.12'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
139
|
+
version: '0.12'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: sus-fixtures-async-http
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.1
|
146
|
+
version: '0.1'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.1
|
153
|
+
version: '0.1'
|
154
154
|
description:
|
155
155
|
email:
|
156
156
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|