falcon 0.29.0 → 0.30.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 +2 -2
- data/lib/falcon/adapters/rack.rb +1 -2
- data/lib/falcon/adapters/response.rb +7 -7
- data/lib/falcon/proxy.rb +2 -2
- data/lib/falcon/version.rb +1 -1
- metadata +6 -7
- data/lib/falcon/adapters/hijack.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a93b677671ad9a275d8d63ec8caeb6f86bed3bfdad56768e558a20afde5326ed
|
4
|
+
data.tar.gz: 60023f6c2a5ad478e7199ff9c33550fb6e51a8dba6ebe200f513039f40ab0be6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bce2c09729a60ab971401426265b9d64652343a45f322d7990ce2c9d966046f71693ecf34044c857ef627856f94b078848072259a99fdc74fbbfea6eecfd2595
|
7
|
+
data.tar.gz: '0449e4726e6fc098aeb44228c32b21c371fd40a97181bc36a0532cba1833555a6f2475fa0e54ae349251b8a1effba209b3d1747f71bbc2837f2b23bd395257da'
|
data/falcon.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_dependency "async", "~> 1.13"
|
23
23
|
spec.add_dependency "async-io", "~> 1.22"
|
24
|
-
spec.add_dependency "async-http", "~> 0.
|
24
|
+
spec.add_dependency "async-http", "~> 0.40.0"
|
25
25
|
spec.add_dependency "async-container", "~> 0.10.0"
|
26
26
|
|
27
27
|
spec.add_dependency "rack", ">= 1.0"
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_development_dependency "trenni"
|
34
34
|
spec.add_development_dependency "async-rspec", "~> 1.7"
|
35
|
-
spec.add_development_dependency "async-websocket", "~> 0.
|
35
|
+
spec.add_development_dependency "async-websocket", "~> 0.9.0"
|
36
36
|
spec.add_development_dependency "async-process", "~> 1.1"
|
37
37
|
|
38
38
|
spec.add_development_dependency "covered", "~> 0.10"
|
data/lib/falcon/adapters/rack.rb
CHANGED
@@ -23,7 +23,6 @@ require 'rack'
|
|
23
23
|
require_relative 'input'
|
24
24
|
require_relative 'response'
|
25
25
|
require_relative 'early_hints'
|
26
|
-
require_relative 'hijack'
|
27
26
|
|
28
27
|
require 'async/logger'
|
29
28
|
|
@@ -185,7 +184,7 @@ module Falcon
|
|
185
184
|
if full_hijack
|
186
185
|
return nil
|
187
186
|
else
|
188
|
-
return Response.wrap(status, headers, body, request
|
187
|
+
return Response.wrap(status, headers, body, request)
|
189
188
|
end
|
190
189
|
rescue => exception
|
191
190
|
@logger.error(self) {exception}
|
@@ -19,10 +19,10 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
require_relative 'output'
|
22
|
-
require_relative 'hijack'
|
23
22
|
require_relative '../version'
|
24
23
|
require_relative '../proxy'
|
25
24
|
|
25
|
+
require 'async/http/body/hijack'
|
26
26
|
require 'time'
|
27
27
|
|
28
28
|
module Falcon
|
@@ -50,16 +50,16 @@ module Falcon
|
|
50
50
|
return headers, meta
|
51
51
|
end
|
52
52
|
|
53
|
-
def self.wrap(status, headers, body, request = nil
|
53
|
+
def self.wrap(status, headers, body, request = nil)
|
54
54
|
headers, meta = wrap_headers(headers)
|
55
55
|
|
56
|
-
if block = meta['rack.hijack']
|
57
|
-
body = Hijack.
|
56
|
+
if block = meta['rack.hijack']
|
57
|
+
body = Async::HTTP::Body::Hijack.wrap(request, &block)
|
58
58
|
else
|
59
|
-
|
59
|
+
ignored = headers.extract(IGNORE_HEADERS)
|
60
60
|
|
61
|
-
unless
|
62
|
-
Async.logger.warn("Ignoring protocol-level headers: #{
|
61
|
+
unless ignored.empty?
|
62
|
+
Async.logger.warn("Ignoring protocol-level headers: #{ignored.inspect}")
|
63
63
|
end
|
64
64
|
|
65
65
|
body = Output.wrap(status, headers, body)
|
data/lib/falcon/proxy.rb
CHANGED
@@ -80,10 +80,10 @@ module Falcon
|
|
80
80
|
|
81
81
|
def prepare_headers(headers)
|
82
82
|
if connection = headers[CONNECTION]
|
83
|
-
headers.
|
83
|
+
headers.extract(connection)
|
84
84
|
end
|
85
85
|
|
86
|
-
headers.
|
86
|
+
headers.extract(HOP_HEADERS)
|
87
87
|
end
|
88
88
|
|
89
89
|
def prepare_request(request, host)
|
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.30.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: 2019-05-
|
11
|
+
date: 2019-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.40.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.40.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: async-container
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
159
|
+
version: 0.9.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
166
|
+
version: 0.9.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: async-process
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,7 +268,6 @@ files:
|
|
268
268
|
- gems/rack3.gemfile
|
269
269
|
- lib/falcon.rb
|
270
270
|
- lib/falcon/adapters/early_hints.rb
|
271
|
-
- lib/falcon/adapters/hijack.rb
|
272
271
|
- lib/falcon/adapters/input.rb
|
273
272
|
- lib/falcon/adapters/output.rb
|
274
273
|
- lib/falcon/adapters/rack.rb
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# Copyright, 2019, 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 'async/http/middleware'
|
22
|
-
require 'async/io/buffer'
|
23
|
-
|
24
|
-
module Falcon
|
25
|
-
module Adapters
|
26
|
-
# This is used for implementing partial hijack.
|
27
|
-
class Hijack
|
28
|
-
def self.for(env, block, socket = nil, task: Async::Task.current)
|
29
|
-
input = socket || env[Rack::RACK_INPUT]
|
30
|
-
output = Async::HTTP::Body::Writable.new
|
31
|
-
|
32
|
-
stream = Hijack.new(input, output)
|
33
|
-
|
34
|
-
task.async do
|
35
|
-
begin
|
36
|
-
block.call(stream)
|
37
|
-
ensure
|
38
|
-
output.close
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
return output
|
43
|
-
end
|
44
|
-
|
45
|
-
def initialize(input, output)
|
46
|
-
@input = input
|
47
|
-
@output = output
|
48
|
-
end
|
49
|
-
|
50
|
-
def read(length = nil, buffer = nil)
|
51
|
-
@input.read(length, buffer)
|
52
|
-
end
|
53
|
-
|
54
|
-
def read_nonblock(length, buffer = nil)
|
55
|
-
@input.read(length, buffer)
|
56
|
-
end
|
57
|
-
|
58
|
-
def write(buffer)
|
59
|
-
@output.write(buffer)
|
60
|
-
end
|
61
|
-
|
62
|
-
alias write_nonblock write
|
63
|
-
|
64
|
-
def flush
|
65
|
-
end
|
66
|
-
|
67
|
-
def close
|
68
|
-
@output.close
|
69
|
-
end
|
70
|
-
|
71
|
-
def close_read
|
72
|
-
if @input.respond_to?(:close_read)
|
73
|
-
@input.close_read
|
74
|
-
else
|
75
|
-
@input.close
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def close_write
|
80
|
-
@output.close
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|