async-http 0.40.0 → 0.40.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/http/body/hijack.rb +6 -8
- data/lib/async/http/body/stream.rb +14 -0
- data/lib/async/http/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19652f31b1217cc8b9e93e6d633e0f4bf5fd8fbd0b2f65ad68ebefee8e5bae8e
|
4
|
+
data.tar.gz: 0a0c185d0127532f1c078dd39719e705f102b5750cc5b62d206f3b535c6f30c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3395f5ac2df1c7b7ca1d966329726bfbed96dbcba0a5f1d17291975c83e1ac76aefd0ed8d5649dc0924688bdc933a24e23250f0fe558ae54e771a4a2c7f4767e
|
7
|
+
data.tar.gz: b2edc23828a9bce9714fb86c2b12eb3dd0795dca1e573b200b52398506c1b591e44cf7364abc017765d4e939aabcc96e3d969a78d26cd796c95126a2be07a84c
|
@@ -44,34 +44,32 @@ module Async
|
|
44
44
|
|
45
45
|
def call(stream)
|
46
46
|
return @block.call(stream)
|
47
|
-
ensure
|
48
|
-
@block = nil
|
49
47
|
end
|
50
48
|
|
51
49
|
# Has the producer called #finish and has the reader consumed the nil token?
|
52
50
|
def empty?
|
53
|
-
@
|
51
|
+
if @stream
|
52
|
+
@stream.empty?
|
53
|
+
else
|
54
|
+
false
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
58
|
# Read the next available chunk.
|
57
59
|
def read
|
58
|
-
return unless @block
|
59
|
-
|
60
60
|
unless @task
|
61
61
|
@stream = Stream.new(@input)
|
62
62
|
|
63
63
|
@task = Task.current.async do
|
64
64
|
@block.call(@stream)
|
65
65
|
end
|
66
|
-
|
67
|
-
@block = nil
|
68
66
|
end
|
69
67
|
|
70
68
|
return @stream.output.read
|
71
69
|
end
|
72
70
|
|
73
71
|
def inspect
|
74
|
-
"\#<#{self.class} #{@block}>"
|
72
|
+
"\#<#{self.class} #{@block.inspect}>"
|
75
73
|
end
|
76
74
|
end
|
77
75
|
end
|
@@ -31,6 +31,7 @@ module Async
|
|
31
31
|
|
32
32
|
# Will hold remaining data in `#read`.
|
33
33
|
@buffer = nil
|
34
|
+
@closed = false
|
34
35
|
end
|
35
36
|
|
36
37
|
attr :input
|
@@ -110,9 +111,22 @@ module Async
|
|
110
111
|
@output&.close
|
111
112
|
end
|
112
113
|
|
114
|
+
# Close the input and output bodies.
|
113
115
|
def close
|
114
116
|
self.close_read
|
115
117
|
self.close_write
|
118
|
+
ensure
|
119
|
+
@closed = true
|
120
|
+
end
|
121
|
+
|
122
|
+
# Whether the stream has been closed.
|
123
|
+
def closed?
|
124
|
+
@closed
|
125
|
+
end
|
126
|
+
|
127
|
+
# Whether there are any output chunks remaining?
|
128
|
+
def empty?
|
129
|
+
@output.empty?
|
116
130
|
end
|
117
131
|
|
118
132
|
private
|
data/lib/async/http/version.rb
CHANGED