falcon 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/falcon.gemspec +1 -1
- data/lib/falcon/input.rb +51 -26
- data/lib/falcon/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfbbbd80fcbe0e419ff2d26f22004bba0fb8bb6674b508b253ebdc44729abebe
|
4
|
+
data.tar.gz: 0dc2c1e25e1e1a5bf19d843ef3b803ebacc855417cdd460bd3e971d8e3ed6e0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bc9ea031a37477c780688caa3ed0ad19625fd91c74f7bc148b7fd83511e4ee646edf4dc85a64521a347e93742b3dbb317781fa4abd26f4074148093d662d335
|
7
|
+
data.tar.gz: 9da626f01d30cfaa3a30174b8fc73eeba209d632cafe708c2d56b6cec7840ea818a6cb1883c3435508ba7a6f5256a1d977c0b255a855081dc9d67c618ef1b12d
|
data/falcon.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_dependency("async-io", "~> 1.6")
|
20
|
-
spec.add_dependency("async-http", "~> 0.
|
20
|
+
spec.add_dependency("async-http", "~> 0.15")
|
21
21
|
spec.add_dependency("async-container", "~> 0.3")
|
22
22
|
|
23
23
|
spec.add_dependency("rack", ">= 1.0")
|
data/lib/falcon/input.rb
CHANGED
@@ -26,19 +26,15 @@ module Falcon
|
|
26
26
|
@body = body
|
27
27
|
@chunks = []
|
28
28
|
|
29
|
-
@
|
30
|
-
@
|
29
|
+
@index = 0
|
30
|
+
@buffer = Async::IO::BinaryString.new
|
31
|
+
@finished = false
|
31
32
|
end
|
32
33
|
|
33
34
|
def each(&block)
|
34
|
-
|
35
|
-
chunk = @chunks[@index]
|
36
|
-
@index += 1
|
37
|
-
yield chunk
|
38
|
-
end
|
35
|
+
return to_enum unless block_given?
|
39
36
|
|
40
|
-
|
41
|
-
@chunks << chunk
|
37
|
+
while chunk = read_next
|
42
38
|
yield chunk
|
43
39
|
end
|
44
40
|
|
@@ -47,30 +43,31 @@ module Falcon
|
|
47
43
|
|
48
44
|
def rewind
|
49
45
|
@index = 0
|
50
|
-
@
|
46
|
+
@finished = false
|
47
|
+
@buffer.clear
|
51
48
|
end
|
52
49
|
|
53
50
|
def read(length = nil, buffer = nil)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
buffer
|
66
|
-
@buffer = nil
|
67
|
-
return buffer
|
51
|
+
if length
|
52
|
+
fill_buffer(length) if @buffer.bytesize <= length
|
53
|
+
|
54
|
+
return @buffer.slice!(0, length)
|
55
|
+
else
|
56
|
+
buffer ||= Async::IO::BinaryString.new
|
57
|
+
|
58
|
+
buffer << @buffer
|
59
|
+
@buffer.clear
|
60
|
+
|
61
|
+
while chunk = read_next
|
62
|
+
buffer << chunk
|
68
63
|
end
|
64
|
+
|
65
|
+
return buffer
|
69
66
|
end
|
70
67
|
end
|
71
68
|
|
72
69
|
def eof?
|
73
|
-
@
|
70
|
+
@finished and @buffer.empty?
|
74
71
|
end
|
75
72
|
|
76
73
|
def gets
|
@@ -78,7 +75,35 @@ module Falcon
|
|
78
75
|
end
|
79
76
|
|
80
77
|
def close
|
81
|
-
@body.
|
78
|
+
@body.finish
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def read_next
|
84
|
+
return nil if @finished
|
85
|
+
|
86
|
+
chunk = nil
|
87
|
+
|
88
|
+
if @index < @chunks.count
|
89
|
+
chunk = @chunks[@index]
|
90
|
+
@index += 1
|
91
|
+
else
|
92
|
+
if chunk = @body.read
|
93
|
+
@chunks << chunk
|
94
|
+
@index += 1
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
@finished = true if chunk.nil?
|
99
|
+
|
100
|
+
return chunk
|
101
|
+
end
|
102
|
+
|
103
|
+
def fill_buffer(length)
|
104
|
+
while @buffer.bytesize < length and chunk = read_next
|
105
|
+
@buffer << chunk
|
106
|
+
end
|
82
107
|
end
|
83
108
|
end
|
84
109
|
end
|
data/lib/falcon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.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-04-
|
11
|
+
date: 2018-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.15'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.15'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-container
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|