async-http 0.25.0 → 0.26.0
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/buffered.rb +1 -1
- data/lib/async/http/body/rewindable.rb +59 -0
- data/lib/async/http/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f41c8e5613af9f0522c24461c31c8cdc410ca04f04fecd3b1e727c716e245f1c
|
4
|
+
data.tar.gz: 965be2b71c176eb7f11c05b182551be39bc17371997b50ea1ca3e8a9745934ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c080e937e8daf6914b9b9f0b37ef16f310fde136f9d834b4a7be11f9a13239927c8ec9e6ec51143b5b27e4f4141a0a9859c321a4d252c60caf3ea0e827537857
|
7
|
+
data.tar.gz: ab34e94fbd6ce5e5e73d8509dd506c3044c95f30d9f37e68491b4426c047a94cab5265c912bca6b5be662bbf2cc01c06f3d1639900d655c98360087685f5a98e
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'wrapper'
|
22
|
+
|
23
|
+
module Async
|
24
|
+
module HTTP
|
25
|
+
module Body
|
26
|
+
# A body which buffers all it's contents.
|
27
|
+
class Rewindable < Wrapper
|
28
|
+
def initialize(body)
|
29
|
+
super(body)
|
30
|
+
|
31
|
+
@chunks = []
|
32
|
+
@index = 0
|
33
|
+
end
|
34
|
+
|
35
|
+
def read
|
36
|
+
if @index < @chunks.count
|
37
|
+
chunk = @chunks[@index]
|
38
|
+
@index += 1
|
39
|
+
else
|
40
|
+
if chunk = super
|
41
|
+
@chunks << chunk
|
42
|
+
@index += 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
return chunk
|
47
|
+
end
|
48
|
+
|
49
|
+
def rewind
|
50
|
+
@index = 0
|
51
|
+
end
|
52
|
+
|
53
|
+
def inspect
|
54
|
+
"\#<#{self.class} #{@index}/#{@chunks.count} chunks read>"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/async/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/async/http/body/fixed.rb
|
147
147
|
- lib/async/http/body/inflate.rb
|
148
148
|
- lib/async/http/body/readable.rb
|
149
|
+
- lib/async/http/body/rewindable.rb
|
149
150
|
- lib/async/http/body/streamable.rb
|
150
151
|
- lib/async/http/body/wrapper.rb
|
151
152
|
- lib/async/http/body/writable.rb
|