falcon 0.18.11 → 0.18.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/falcon.gemspec +1 -1
- data/lib/falcon/adapters/output.rb +23 -3
- 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: 93e14e6d1adc3612ea4aebe67330592f0ab88334233c040bc44d45e535d41857
|
|
4
|
+
data.tar.gz: 1de87234e979e282227baa43b85c28f8ac78c4c64c4373f4c0d143a204fa237e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2b74b2c490a6d4ea59080460c99ef171dbfdc3a882c1d7a6c9810c4104f90d4622acae2152a1526924b47c808cee8209076115711d04b6bdb9c01cdef40cba5
|
|
7
|
+
data.tar.gz: e7f0630c85efbe622265c7a45c94898b0208c8d2ea98bcf0b6467eec44152836ebedce11a23d823b10ada6c1e6ad5897655c31f16c5e700edcfffdb4e836c3d0
|
data/falcon.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.add_dependency("http-protocol", "~> 0.5.0")
|
|
20
20
|
|
|
21
21
|
spec.add_dependency("async-io", "~> 1.9")
|
|
22
|
-
spec.add_dependency("async-http", "~> 0.
|
|
22
|
+
spec.add_dependency("async-http", "~> 0.32.0")
|
|
23
23
|
spec.add_dependency("async-container", "~> 0.6.0")
|
|
24
24
|
|
|
25
25
|
spec.add_dependency("rack", ">= 1.0")
|
|
@@ -23,6 +23,8 @@ require 'async/http/body/file'
|
|
|
23
23
|
|
|
24
24
|
module Falcon
|
|
25
25
|
module Adapters
|
|
26
|
+
# Wraps the rack response body.
|
|
27
|
+
# The Body must respond to each and must only yield String values. The Body itself should not be an instance of String, as this will break in Ruby 1.9. If the Body responds to close, it will be called after iteration. If the body is replaced by a middleware after action, the original body must be closed first, if it responds to close. If the Body responds to to_path, it must return a String identifying the location of a file whose contents are identical to that produced by calling each; this may be used by the server as an alternative, possibly more efficient way to transport the response. The Body commonly is an Array of Strings, the application instance itself, or a File-like object.
|
|
26
28
|
class Output < Async::HTTP::Body::Readable
|
|
27
29
|
CONTENT_LENGTH = 'content-length'.freeze
|
|
28
30
|
|
|
@@ -30,6 +32,7 @@ module Falcon
|
|
|
30
32
|
def self.wrap(status, headers, body)
|
|
31
33
|
# In no circumstance do we want this header propagating out:
|
|
32
34
|
if content_length = headers.delete(CONTENT_LENGTH)
|
|
35
|
+
# We don't really trust the user to provide the right length to the transport.
|
|
33
36
|
content_length = Integer(content_length)
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -44,21 +47,38 @@ module Falcon
|
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def initialize(headers, body, length)
|
|
47
|
-
# We don't trust the user to provide the right length to the transport.
|
|
48
50
|
@length = length
|
|
49
|
-
|
|
50
51
|
@body = body
|
|
52
|
+
|
|
53
|
+
# An enumerator over the rack response body:
|
|
51
54
|
@chunks = body.to_enum(:each)
|
|
52
55
|
end
|
|
53
56
|
|
|
57
|
+
# The rack response body.
|
|
58
|
+
attr :body
|
|
59
|
+
|
|
60
|
+
# The content length of the rack response body.
|
|
54
61
|
attr :length
|
|
55
62
|
|
|
56
63
|
def empty?
|
|
57
64
|
@length == 0 or (@body.respond_to?(:empty?) and @body.empty?)
|
|
58
65
|
end
|
|
59
66
|
|
|
67
|
+
def close(error = nil)
|
|
68
|
+
if @body and @body.respond_to?(:close)
|
|
69
|
+
@body.close
|
|
70
|
+
@body = nil
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
@chunks = nil
|
|
74
|
+
|
|
75
|
+
super
|
|
76
|
+
end
|
|
77
|
+
|
|
60
78
|
def read
|
|
61
|
-
@chunks
|
|
79
|
+
if @chunks
|
|
80
|
+
return @chunks.next
|
|
81
|
+
end
|
|
62
82
|
rescue StopIteration
|
|
63
83
|
nil
|
|
64
84
|
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.18.
|
|
4
|
+
version: 0.18.12
|
|
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-10-
|
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: http-protocol
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.
|
|
47
|
+
version: 0.32.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.
|
|
54
|
+
version: 0.32.0
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: async-container
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|