falcon 0.36.5 → 0.37.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/falcon/adapters/rack.rb +2 -8
- data/lib/falcon/adapters/response.rb +2 -2
- data/lib/falcon/command/host.rb +9 -1
- data/lib/falcon/command/serve.rb +5 -1
- data/lib/falcon/controller/serve.rb +3 -1
- data/lib/falcon/environments/application.rb +5 -1
- data/lib/falcon/service/application.rb +15 -2
- data/lib/falcon/version.rb +1 -1
- data/lib/rack/handler/falcon.rb +1 -1
- metadata +50 -51
- data/lib/falcon/adapters/early_hints.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09f68bf38932459e8910a73127f36a45c0d078343ddef8aebe11dbcb763ae8f6'
|
4
|
+
data.tar.gz: e2d295f7010e11a46beacda059ddcd93f3213b6d5b2a7975fec13f944f4d74cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 105b697d684f3824b4be897cb47f881cb2d4f678031bd206acd1f890d973afc81b550ca19aec3cc9b02d082a5218d1964d3d852ac35409c417d6325438a4bcc0
|
7
|
+
data.tar.gz: 6aee908ade5635f2d9693abcc07b3a59c83affdd7e10c683a8c87c435e40c9c4b8ee87da5764456409b87937f32ec788c434c9247e6f9abe2178312ff6000233
|
data/lib/falcon/adapters/rack.rb
CHANGED
@@ -24,7 +24,6 @@ require 'rack'
|
|
24
24
|
|
25
25
|
require_relative 'input'
|
26
26
|
require_relative 'response'
|
27
|
-
require_relative 'early_hints'
|
28
27
|
|
29
28
|
require 'async/logger'
|
30
29
|
|
@@ -60,7 +59,6 @@ module Falcon
|
|
60
59
|
RACK_HIJACK = 'rack.hijack'
|
61
60
|
RACK_IS_HIJACK = 'rack.hijack?'
|
62
61
|
RACK_HIJACK_IO = 'rack.hijack_io'
|
63
|
-
RACK_EARLY_HINTS = "rack.early_hints"
|
64
62
|
|
65
63
|
# Async::HTTP specific metadata:
|
66
64
|
|
@@ -175,8 +173,8 @@ module Falcon
|
|
175
173
|
RACK_URL_SCHEME => request.scheme,
|
176
174
|
|
177
175
|
# I'm not sure what sane defaults should be here:
|
178
|
-
SERVER_NAME => server_name
|
179
|
-
SERVER_PORT => server_port
|
176
|
+
SERVER_NAME => server_name,
|
177
|
+
SERVER_PORT => server_port,
|
180
178
|
|
181
179
|
# We support both request and response hijack.
|
182
180
|
RACK_IS_HIJACK => true,
|
@@ -184,10 +182,6 @@ module Falcon
|
|
184
182
|
|
185
183
|
self.unwrap_request(request, env)
|
186
184
|
|
187
|
-
if request.push?
|
188
|
-
env[RACK_EARLY_HINTS] = EarlyHints.new(request)
|
189
|
-
end
|
190
|
-
|
191
185
|
full_hijack = false
|
192
186
|
|
193
187
|
if request.hijack?
|
@@ -92,10 +92,10 @@ module Falcon
|
|
92
92
|
protocol = meta['rack.protocol']
|
93
93
|
|
94
94
|
# https://tools.ietf.org/html/rfc7231#section-7.4.2
|
95
|
-
headers.add('server', "falcon/#{Falcon::VERSION}")
|
95
|
+
# headers.add('server', "falcon/#{Falcon::VERSION}")
|
96
96
|
|
97
97
|
# https://tools.ietf.org/html/rfc7231#section-7.1.1.2
|
98
|
-
headers.add('date', Time.now.httpdate)
|
98
|
+
# headers.add('date', Time.now.httpdate)
|
99
99
|
|
100
100
|
return self.new(status, headers, body, protocol)
|
101
101
|
end
|
data/lib/falcon/command/host.rb
CHANGED
@@ -71,7 +71,15 @@ module Falcon
|
|
71
71
|
buffer.puts "- To reload: kill -HUP #{Process.pid}"
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
begin
|
75
|
+
Bundler.require(:preload)
|
76
|
+
rescue Bundler::GemfileNotFound
|
77
|
+
# Ignore.
|
78
|
+
end
|
79
|
+
|
80
|
+
if GC.respond_to?(:compact)
|
81
|
+
GC.compact
|
82
|
+
end
|
75
83
|
|
76
84
|
self.controller.run
|
77
85
|
end
|
data/lib/falcon/command/serve.rb
CHANGED
@@ -68,6 +68,8 @@ module Falcon
|
|
68
68
|
Async::IO::SharedEndpoint.bound(@endpoint)
|
69
69
|
end.wait
|
70
70
|
|
71
|
+
Async.logger.info(self) { "Starting #{name} on #{@endpoint.to_url}" }
|
72
|
+
|
71
73
|
@debug_trap.ignore!
|
72
74
|
|
73
75
|
super
|
@@ -100,7 +102,7 @@ module Falcon
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
server = Falcon::Server.new(app, @bound_endpoint, @endpoint.protocol, @endpoint.scheme)
|
105
|
+
server = Falcon::Server.new(app, @bound_endpoint, protocol: @endpoint.protocol, scheme: @endpoint.scheme)
|
104
106
|
|
105
107
|
server.run
|
106
108
|
|
@@ -42,6 +42,12 @@ module Falcon
|
|
42
42
|
@environment.evaluator.middleware
|
43
43
|
end
|
44
44
|
|
45
|
+
# Number of instances to start.
|
46
|
+
# @returns [Integer | nil]
|
47
|
+
def count
|
48
|
+
@environment.evaluator.count
|
49
|
+
end
|
50
|
+
|
45
51
|
# Preload any resources specified by the environment.
|
46
52
|
def preload!
|
47
53
|
if scripts = @evaluator.preload
|
@@ -73,11 +79,18 @@ module Falcon
|
|
73
79
|
protocol = self.protocol
|
74
80
|
scheme = self.scheme
|
75
81
|
|
76
|
-
|
82
|
+
run_options = {
|
83
|
+
name: self.name,
|
84
|
+
restart: true,
|
85
|
+
}
|
86
|
+
|
87
|
+
run_options[:count] = count unless count.nil?
|
88
|
+
|
89
|
+
container.run(**run_options) do |instance|
|
77
90
|
Async(logger: logger) do |task|
|
78
91
|
Async.logger.info(self) {"Starting application server for #{self.root}..."}
|
79
92
|
|
80
|
-
server = Server.new(self.middleware, @bound_endpoint, protocol, scheme)
|
93
|
+
server = Server.new(self.middleware, @bound_endpoint, protocol: protocol, scheme: scheme)
|
81
94
|
|
82
95
|
server.run
|
83
96
|
|
data/lib/falcon/version.rb
CHANGED
data/lib/rack/handler/falcon.rb
CHANGED
@@ -32,7 +32,7 @@ module Rack
|
|
32
32
|
app = ::Falcon::Adapters::Rack.new(app)
|
33
33
|
app = ::Falcon::Adapters::Rewindable.new(app)
|
34
34
|
|
35
|
-
server = ::Falcon::Server.new(app, endpoint, Async::HTTP::Protocol::HTTP1, SCHEME)
|
35
|
+
server = ::Falcon::Server.new(app, endpoint, protocol: Async::HTTP::Protocol::HTTP1, scheme: SCHEME)
|
36
36
|
yield server if block_given?
|
37
37
|
|
38
38
|
Async::Reactor.run do
|
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.37.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -25,89 +25,89 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: async-
|
28
|
+
name: async-container
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.16.0
|
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:
|
40
|
+
version: 0.16.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-http
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.54.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.54.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: async-http-cache
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.3.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.3.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: async-
|
70
|
+
name: async-io
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '1.22'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '1.22'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: build-environment
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.13'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.13'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: localhost
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,91 +123,91 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: process-metrics
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.2.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.2.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rack
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '1.0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '1.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: samovar
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '1
|
160
|
-
type: :
|
159
|
+
version: '2.1'
|
160
|
+
type: :runtime
|
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: '1
|
166
|
+
version: '2.1'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name: async-
|
168
|
+
name: async-process
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: '1.1'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: '1.1'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name: async-
|
182
|
+
name: async-rspec
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: '1.
|
187
|
+
version: '1.7'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '1.
|
194
|
+
version: '1.7'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: async-websocket
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- - "
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 0.14.0
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - "
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 0.14.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
210
|
+
name: bake
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - ">="
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
224
|
+
name: covered
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
@@ -250,7 +250,6 @@ dependencies:
|
|
250
250
|
version: '3.6'
|
251
251
|
description:
|
252
252
|
email:
|
253
|
-
- samuel.williams@oriontransfer.co.nz
|
254
253
|
executables:
|
255
254
|
- falcon
|
256
255
|
- falcon-host
|
@@ -261,7 +260,6 @@ files:
|
|
261
260
|
- bin/falcon
|
262
261
|
- bin/falcon-host
|
263
262
|
- lib/falcon.rb
|
264
|
-
- lib/falcon/adapters/early_hints.rb
|
265
263
|
- lib/falcon/adapters/input.rb
|
266
264
|
- lib/falcon/adapters/output.rb
|
267
265
|
- lib/falcon/adapters/rack.rb
|
@@ -306,7 +304,8 @@ files:
|
|
306
304
|
- lib/falcon/version.rb
|
307
305
|
- lib/rack/handler/falcon.rb
|
308
306
|
homepage: https://github.com/socketry/falcon
|
309
|
-
licenses:
|
307
|
+
licenses:
|
308
|
+
- MIT
|
310
309
|
metadata: {}
|
311
310
|
post_install_message:
|
312
311
|
rdoc_options: []
|
@@ -314,7 +313,7 @@ require_paths:
|
|
314
313
|
- lib
|
315
314
|
required_ruby_version: !ruby/object:Gem::Requirement
|
316
315
|
requirements:
|
317
|
-
- - "
|
316
|
+
- - ">="
|
318
317
|
- !ruby/object:Gem::Version
|
319
318
|
version: '2.5'
|
320
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require 'protocol/http/middleware'
|
24
|
-
|
25
|
-
module Falcon
|
26
|
-
module Adapters
|
27
|
-
# Provide an interface for advising the client to preload related resources.
|
28
|
-
class EarlyHints
|
29
|
-
PRELOAD = /<(?<path>.*?)>;.*?rel=preload/
|
30
|
-
|
31
|
-
# Initialize the early hints interface.
|
32
|
-
#
|
33
|
-
# @parameter request [Protocol::HTTP::Request]
|
34
|
-
def initialize(request)
|
35
|
-
@request = request
|
36
|
-
end
|
37
|
-
|
38
|
-
# Advise the request that the specified path should be preloaded.
|
39
|
-
# @parameter path [String]
|
40
|
-
# @parameter preload [Boolean] whether the client should preload the resource.
|
41
|
-
def push(path, preload: true, **options)
|
42
|
-
@request.push(path)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Extract link headers and invoke {push}.
|
46
|
-
def call(headers)
|
47
|
-
headers.each do |key, value|
|
48
|
-
if key.casecmp("link").zero? and match = PRELOAD.match(value)
|
49
|
-
@request.push(match[:path])
|
50
|
-
else
|
51
|
-
Async.logger.warn(@request) {"Unsure how to handle early hints header: #{key}"}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|