falcon 0.48.3 → 0.48.4
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
- checksums.yaml.gz.sig +0 -0
- data/bake/falcon/supervisor.rb +2 -2
- data/bin/falcon +1 -1
- data/bin/falcon-host +1 -1
- data/lib/falcon/command/host.rb +4 -4
- data/lib/falcon/command/paths.rb +1 -1
- data/lib/falcon/command/proxy.rb +5 -5
- data/lib/falcon/command/redirect.rb +6 -6
- data/lib/falcon/command/serve.rb +21 -21
- data/lib/falcon/command/supervisor.rb +10 -10
- data/lib/falcon/command/top.rb +19 -19
- data/lib/falcon/command/virtual.rb +6 -6
- data/lib/falcon/command.rb +2 -2
- data/lib/falcon/configuration.rb +1 -1
- data/lib/falcon/endpoint.rb +3 -3
- data/lib/falcon/environment/application.rb +3 -3
- data/lib/falcon/environment/lets_encrypt_tls.rb +3 -3
- data/lib/falcon/environment/proxy.rb +5 -5
- data/lib/falcon/environment/rack.rb +3 -3
- data/lib/falcon/environment/rackup.rb +3 -3
- data/lib/falcon/environment/redirect.rb +2 -2
- data/lib/falcon/environment/self_signed_tls.rb +3 -3
- data/lib/falcon/environment/server.rb +4 -4
- data/lib/falcon/environment/supervisor.rb +3 -3
- data/lib/falcon/environment/tls.rb +2 -2
- data/lib/falcon/environment/virtual.rb +2 -2
- data/lib/falcon/middleware/proxy.rb +20 -20
- data/lib/falcon/middleware/redirect.rb +5 -5
- data/lib/falcon/middleware/verbose.rb +3 -3
- data/lib/falcon/proxy_endpoint.rb +1 -1
- data/lib/falcon/rackup/handler.rb +5 -7
- data/lib/falcon/server.rb +7 -7
- data/lib/falcon/service/server.rb +3 -3
- data/lib/falcon/service/supervisor.rb +7 -7
- data/lib/falcon/service/virtual.rb +4 -4
- data/lib/falcon/version.rb +1 -1
- data/lib/rack/handler/falcon.rb +11 -5
- data/lib/rackup/handler/falcon.rb +10 -4
- data/license.md +4 -2
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +1 -1
- metadata +12 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b4caa19c4227d2fdeeb8a700a20be255a12f3bee3d2aa69ea31d9a8c7a2508b
|
4
|
+
data.tar.gz: 6ae1117406cc230dad0447a43fd35ef94b1361dbe196a3e1e2ebd29700a7e228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75086f0c0c1c552b9201d26b2ef3c3cc394ecb64c596642ff62ad73c361fac5493b867aa19becfd1aa4b6e0b7dfe1abba334c276df2ba5ca0dc194df759f007c
|
7
|
+
data.tar.gz: d19a36195d9521d3ac0d7ae4db56b6521cfd0e2bfbaf5ade95408c8cd557d6bf3c8733cda818a84980c61fed3a05fce936af85fb53807d15216ab4d8a88733e1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/falcon/supervisor.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2025, by Samuel Williams.
|
5
5
|
|
6
6
|
def restart
|
7
|
-
require_relative
|
7
|
+
require_relative "../../lib/falcon/command/supervisor"
|
8
8
|
|
9
9
|
Falcon::Command::Supervisor["restart"].call
|
10
10
|
end
|
data/bin/falcon
CHANGED
data/bin/falcon-host
CHANGED
data/lib/falcon/command/host.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "paths"
|
7
|
+
require_relative "../version"
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
9
|
+
require "samovar"
|
10
|
+
require "async/service/controller"
|
11
11
|
|
12
12
|
module Falcon
|
13
13
|
module Command
|
data/lib/falcon/command/paths.rb
CHANGED
data/lib/falcon/command/proxy.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../environment/proxy"
|
7
|
+
require_relative "paths"
|
8
8
|
|
9
|
-
require
|
9
|
+
require "samovar"
|
10
10
|
|
11
11
|
module Falcon
|
12
12
|
module Command
|
@@ -19,9 +19,9 @@ module Falcon
|
|
19
19
|
# The command line options.
|
20
20
|
# @attribute [Samovar::Options]
|
21
21
|
options do
|
22
|
-
option
|
22
|
+
option "--bind <address>", "Bind to the given hostname/address", default: "https://[::]:443"
|
23
23
|
|
24
|
-
option
|
24
|
+
option "-t/--timeout <duration>", "Specify the maximum time to wait for non-blocking operations.", type: Float, default: nil
|
25
25
|
end
|
26
26
|
|
27
27
|
# One or more paths to the configuration files.
|
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../environment/redirect"
|
7
|
+
require_relative "paths"
|
8
8
|
|
9
|
-
require
|
9
|
+
require "samovar"
|
10
10
|
|
11
11
|
module Falcon
|
12
12
|
module Command
|
@@ -16,10 +16,10 @@ module Falcon
|
|
16
16
|
# The command line options.
|
17
17
|
# @attribute [Samovar::Options]
|
18
18
|
options do
|
19
|
-
option
|
20
|
-
option
|
19
|
+
option "--bind <address>", "Bind to the given hostname/address", default: "http://[::]:80"
|
20
|
+
option "--redirect <address>", "Redirect using this address as a template.", default: "https://[::]:443"
|
21
21
|
|
22
|
-
option
|
22
|
+
option "-t/--timeout <duration>", "Specify the maximum time to wait for non-blocking operations.", type: Float, default: nil
|
23
23
|
end
|
24
24
|
|
25
25
|
# One or more paths to the configuration files.
|
data/lib/falcon/command/serve.rb
CHANGED
@@ -4,15 +4,15 @@
|
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2018, by Mitsutaka Mimura.
|
6
6
|
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
7
|
+
require_relative "../server"
|
8
|
+
require_relative "../endpoint"
|
9
|
+
require_relative "../configuration"
|
10
|
+
require_relative "../service/server"
|
11
|
+
require_relative "../environment/rackup"
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
13
|
+
require "async/container"
|
14
|
+
require "async/http/client"
|
15
|
+
require "samovar"
|
16
16
|
|
17
17
|
module Falcon
|
18
18
|
module Command
|
@@ -25,26 +25,26 @@ module Falcon
|
|
25
25
|
# The command line options.
|
26
26
|
# @attribute [Samovar::Options]
|
27
27
|
options do
|
28
|
-
option
|
28
|
+
option "-b/--bind <address>", "Bind to the given hostname/address.", default: "https://localhost:9292"
|
29
29
|
|
30
|
-
option
|
31
|
-
option
|
32
|
-
option
|
30
|
+
option "-p/--port <number>", "Override the specified port.", type: Integer
|
31
|
+
option "-h/--hostname <hostname>", "Specify the hostname which would be used for certificates, etc."
|
32
|
+
option "-t/--timeout <duration>", "Specify the maximum time to wait for non-blocking operations.", type: Float, default: nil
|
33
33
|
|
34
|
-
option
|
35
|
-
option
|
34
|
+
option "-c/--config <path>", "Rackup configuration file to load.", default: "config.ru"
|
35
|
+
option "--preload <path>", "Preload the specified path before creating containers."
|
36
36
|
|
37
|
-
option
|
37
|
+
option "--cache", "Enable the response cache."
|
38
38
|
|
39
|
-
option
|
39
|
+
option "--forked | --threaded | --hybrid", "Select a specific parallelism model.", key: :container, default: :forked
|
40
40
|
|
41
|
-
option
|
41
|
+
option "-n/--count <count>", "Number of instances to start.", default: Async::Container.processor_count, type: Integer
|
42
42
|
|
43
|
-
option
|
44
|
-
option
|
43
|
+
option "--forks <count>", "Number of forks (hybrid only).", type: Integer
|
44
|
+
option "--threads <count>", "Number of threads (hybrid only).", type: Integer
|
45
45
|
|
46
|
-
option
|
47
|
-
option
|
46
|
+
option "--[no]-restart", "Enable/disable automatic restart.", default: true
|
47
|
+
option "--graceful-stop <timeout>", "Duration to wait for graceful stop.", type: Float, default: 1.0
|
48
48
|
end
|
49
49
|
|
50
50
|
def container_options
|
@@ -3,12 +3,12 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require "samovar"
|
7
|
+
require "async"
|
8
|
+
require "json"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "io/endpoint/unix_endpoint"
|
11
|
+
require "io/stream"
|
12
12
|
|
13
13
|
module Falcon
|
14
14
|
module Command
|
@@ -30,7 +30,7 @@ module Falcon
|
|
30
30
|
|
31
31
|
# Send the restart message to the supervisor.
|
32
32
|
def call(stream)
|
33
|
-
stream.puts({please:
|
33
|
+
stream.puts({please: "restart"}.to_json, separator: "\0")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ module Falcon
|
|
40
40
|
|
41
41
|
# Send the metrics message to the supervisor and print the results.
|
42
42
|
def call(stream)
|
43
|
-
stream.puts({please:
|
43
|
+
stream.puts({please: "metrics"}.to_json, separator: "\0", chomp: true)
|
44
44
|
response = JSON.parse(stream.read_until("\0"), symbolize_names: true)
|
45
45
|
|
46
46
|
$stdout.puts response
|
@@ -51,9 +51,9 @@ module Falcon
|
|
51
51
|
# @name nested
|
52
52
|
# @attribute [Command]
|
53
53
|
nested :command, {
|
54
|
-
|
55
|
-
|
56
|
-
}, default:
|
54
|
+
"restart" => Restart,
|
55
|
+
"metrics" => Metrics,
|
56
|
+
}, default: "metrics"
|
57
57
|
|
58
58
|
# The endpoint the supervisor is bound to.
|
59
59
|
def endpoint
|
data/lib/falcon/command/top.rb
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
6
|
+
require_relative "serve"
|
7
|
+
require_relative "host"
|
8
|
+
require_relative "virtual"
|
9
|
+
require_relative "proxy"
|
10
|
+
require_relative "redirect"
|
11
|
+
require_relative "supervisor"
|
12
12
|
|
13
|
-
require_relative
|
13
|
+
require_relative "../version"
|
14
14
|
|
15
|
-
require
|
15
|
+
require "samovar"
|
16
16
|
|
17
17
|
module Falcon
|
18
18
|
module Command
|
@@ -23,23 +23,23 @@ module Falcon
|
|
23
23
|
# The command line options.
|
24
24
|
# @attribute [Samovar::Options]
|
25
25
|
options do
|
26
|
-
option
|
27
|
-
option
|
28
|
-
option
|
29
|
-
option
|
26
|
+
option "--verbose | --quiet", "Verbosity of output for debugging.", key: :logging
|
27
|
+
option "-h/--help", "Print out help information."
|
28
|
+
option "-v/--version", "Print out the application version."
|
29
|
+
option "-e/--encoding", "Specify the default external encoding of the server.", default: "UTF-8"
|
30
30
|
end
|
31
31
|
|
32
32
|
# The nested command to execute.
|
33
33
|
# @name nested
|
34
34
|
# @attribute [Command]
|
35
35
|
nested :command, {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}, default:
|
36
|
+
"serve" => Serve,
|
37
|
+
"host" => Host,
|
38
|
+
"virtual" => Virtual,
|
39
|
+
"proxy" => Proxy,
|
40
|
+
"redirect" => Redirect,
|
41
|
+
"supervisor" => Supervisor,
|
42
|
+
}, default: "serve"
|
43
43
|
|
44
44
|
# Whether verbose logging is enabled.
|
45
45
|
# @returns [Boolean]
|
@@ -3,11 +3,11 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "async/service"
|
7
7
|
|
8
|
-
require_relative
|
8
|
+
require_relative "../environment/virtual"
|
9
9
|
|
10
|
-
require
|
10
|
+
require "samovar"
|
11
11
|
|
12
12
|
module Falcon
|
13
13
|
module Command
|
@@ -20,10 +20,10 @@ module Falcon
|
|
20
20
|
# The command line options.
|
21
21
|
# @attribute [Samovar::Options]
|
22
22
|
options do
|
23
|
-
option
|
24
|
-
option
|
23
|
+
option "--bind-insecure <address>", "Bind redirection to the given hostname/address", default: "http://[::]:80"
|
24
|
+
option "--bind-secure <address>", "Bind proxy to the given hostname/address", default: "https://[::]:443"
|
25
25
|
|
26
|
-
option
|
26
|
+
option "-t/--timeout <duration>", "Specify the maximum time to wait for non-blocking operations.", type: Float, default: 30
|
27
27
|
end
|
28
28
|
|
29
29
|
# One or more paths to the configuration files.
|
data/lib/falcon/command.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
# Copyright, 2018, by Mitsutaka Mimura.
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "command/top"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
module Command
|
data/lib/falcon/configuration.rb
CHANGED
data/lib/falcon/endpoint.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "async/http/endpoint"
|
7
|
+
require "localhost/authority"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
# An HTTP-specific endpoint which adds localhost TLS.
|
@@ -4,8 +4,8 @@
|
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2020, by Daniel Evans.
|
6
6
|
|
7
|
-
require_relative
|
8
|
-
require_relative
|
7
|
+
require_relative "server"
|
8
|
+
require_relative "../proxy_endpoint"
|
9
9
|
|
10
10
|
module Falcon
|
11
11
|
module Environment
|
@@ -22,7 +22,7 @@ module Falcon
|
|
22
22
|
# The scheme to use to communicate with the application.
|
23
23
|
# @returns [String]
|
24
24
|
def scheme
|
25
|
-
|
25
|
+
"https"
|
26
26
|
end
|
27
27
|
|
28
28
|
# The protocol to use to communicate with the application.
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "tls"
|
7
|
+
require_relative "../environment"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
module Environment
|
@@ -13,7 +13,7 @@ module Falcon
|
|
13
13
|
# The Lets Encrypt certificate store path.
|
14
14
|
# @parameter [String]
|
15
15
|
def lets_encrypt_root
|
16
|
-
|
16
|
+
"/etc/letsencrypt/live"
|
17
17
|
end
|
18
18
|
|
19
19
|
# The public certificate path.
|
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
6
|
+
require_relative "server"
|
7
|
+
require_relative "../tls"
|
8
|
+
require_relative "../middleware/proxy"
|
9
|
+
require_relative "../environment"
|
10
10
|
|
11
11
|
module Falcon
|
12
12
|
module Environment
|
@@ -43,7 +43,7 @@ module Falcon
|
|
43
43
|
Console.info(self) {"Proxying #{self.url} to #{evaluator.authority} using #{evaluator.endpoint}"}
|
44
44
|
hosts[evaluator.authority] = evaluator
|
45
45
|
|
46
|
-
if RUBY_VERSION <
|
46
|
+
if RUBY_VERSION < "3.1"
|
47
47
|
# Ensure the SSL context is set up before forking - it's buggy on Ruby < 3.1:
|
48
48
|
evaluator.ssl_context
|
49
49
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
6
|
+
require_relative "application"
|
7
|
+
require_relative "rackup"
|
8
|
+
require_relative "../environment"
|
9
9
|
|
10
10
|
module Falcon
|
11
11
|
module Environment
|
@@ -3,15 +3,15 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require_relative
|
6
|
+
require "rack/builder"
|
7
|
+
require_relative "../server"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
module Environment
|
11
11
|
# Provides an environment for hosting loading a Rackup `config.ru` file.
|
12
12
|
module Rackup
|
13
13
|
def rackup_path
|
14
|
-
File.expand_path(
|
14
|
+
File.expand_path("config.ru", root)
|
15
15
|
end
|
16
16
|
|
17
17
|
def rack_app
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "server"
|
7
|
+
require_relative "../middleware/redirect"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
module Environment
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require_relative
|
8
|
-
require_relative
|
6
|
+
require "localhost/authority"
|
7
|
+
require_relative "tls"
|
8
|
+
require_relative "../environment"
|
9
9
|
|
10
10
|
module Falcon
|
11
11
|
module Environment
|
@@ -3,11 +3,11 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "async/service/generic"
|
7
|
+
require "async/http/endpoint"
|
8
8
|
|
9
|
-
require_relative
|
10
|
-
require_relative
|
9
|
+
require_relative "../service/server"
|
10
|
+
require_relative "../server"
|
11
11
|
|
12
12
|
module Falcon
|
13
13
|
module Environment
|
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../service/supervisor"
|
7
|
+
require_relative "../environment"
|
8
8
|
|
9
|
-
require
|
9
|
+
require "io/endpoint/unix_endpoint"
|
10
10
|
|
11
11
|
module Falcon
|
12
12
|
module Environment
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "configured"
|
7
7
|
|
8
|
-
require_relative
|
8
|
+
require_relative "../service/virtual"
|
9
9
|
|
10
10
|
module Falcon
|
11
11
|
module Environment
|
@@ -3,12 +3,12 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require "async/http/client"
|
7
|
+
require "protocol/http/headers"
|
8
|
+
require "protocol/http/middleware"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "console/event/failure"
|
11
|
+
require "traces/provider"
|
12
12
|
|
13
13
|
module Falcon
|
14
14
|
module Middleware
|
@@ -25,21 +25,21 @@ module Falcon
|
|
25
25
|
# A HTTP middleware for proxying requests to a given set of hosts.
|
26
26
|
# Typically used for implementing virtual servers.
|
27
27
|
class Proxy < Protocol::HTTP::Middleware
|
28
|
-
FORWARDED =
|
29
|
-
X_FORWARDED_FOR =
|
30
|
-
X_FORWARDED_PROTO =
|
28
|
+
FORWARDED = "forwarded"
|
29
|
+
X_FORWARDED_FOR = "x-forwarded-for"
|
30
|
+
X_FORWARDED_PROTO = "x-forwarded-proto"
|
31
31
|
|
32
|
-
VIA =
|
33
|
-
CONNECTION =
|
32
|
+
VIA = "via"
|
33
|
+
CONNECTION = "connection"
|
34
34
|
|
35
35
|
# HTTP hop headers which *should* not be passed through the proxy.
|
36
36
|
HOP_HEADERS = [
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
"connection",
|
38
|
+
"keep-alive",
|
39
|
+
"public",
|
40
|
+
"proxy-authenticate",
|
41
|
+
"transfer-encoding",
|
42
|
+
"upgrade",
|
43
43
|
]
|
44
44
|
|
45
45
|
# Initialize the proxy middleware.
|
@@ -78,7 +78,7 @@ module Falcon
|
|
78
78
|
# @returns [Service::Proxy]
|
79
79
|
def lookup(request)
|
80
80
|
# Trailing dot and port is ignored/normalized.
|
81
|
-
if authority = request.authority&.sub(/(\.)?(:\d+)?$/,
|
81
|
+
if authority = request.authority&.sub(/(\.)?(:\d+)?$/, "")
|
82
82
|
return @hosts[authority]
|
83
83
|
end
|
84
84
|
end
|
@@ -119,7 +119,7 @@ module Falcon
|
|
119
119
|
end
|
120
120
|
|
121
121
|
unless forwarded.empty?
|
122
|
-
request.headers.add(FORWARDED, forwarded.join(
|
122
|
+
request.headers.add(FORWARDED, forwarded.join(";"))
|
123
123
|
end
|
124
124
|
|
125
125
|
request.headers.add(VIA, "#{request.version} #{self.class}")
|
@@ -145,7 +145,7 @@ module Falcon
|
|
145
145
|
end
|
146
146
|
rescue => error
|
147
147
|
Console::Event::Failure.for(error).emit(self)
|
148
|
-
return Protocol::HTTP::Response[502, {
|
148
|
+
return Protocol::HTTP::Response[502, {"content-type" => "text/plain"}, [error.class.name]]
|
149
149
|
end
|
150
150
|
|
151
151
|
Traces::Provider(self) do
|
@@ -154,7 +154,7 @@ module Falcon
|
|
154
154
|
"authority" => request.authority,
|
155
155
|
}
|
156
156
|
|
157
|
-
Traces.trace(
|
157
|
+
Traces.trace("falcon.middleware.proxy.call", attributes: attributes) do
|
158
158
|
super
|
159
159
|
end
|
160
160
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "async/http/client"
|
7
7
|
|
8
8
|
module Falcon
|
9
9
|
module Middleware
|
@@ -35,7 +35,7 @@ module Falcon
|
|
35
35
|
# @parameter request [Protocol::HTTP::Request]
|
36
36
|
def lookup(request)
|
37
37
|
# Trailing dot and port is ignored/normalized.
|
38
|
-
if authority = request.authority&.sub(/(\.)?(:\d+)?$/,
|
38
|
+
if authority = request.authority&.sub(/(\.)?(:\d+)?$/, "")
|
39
39
|
return @hosts[authority]
|
40
40
|
end
|
41
41
|
end
|
@@ -50,7 +50,7 @@ module Falcon
|
|
50
50
|
location = "#{@endpoint.scheme}://#{host.authority}:#{@endpoint.port}#{request.path}"
|
51
51
|
end
|
52
52
|
|
53
|
-
return Protocol::HTTP::Response[301, [[
|
53
|
+
return Protocol::HTTP::Response[301, [["location", location]], []]
|
54
54
|
else
|
55
55
|
super
|
56
56
|
end
|
@@ -58,7 +58,7 @@ module Falcon
|
|
58
58
|
|
59
59
|
Traces::Provider(self) do
|
60
60
|
def call(request)
|
61
|
-
Traces.trace(
|
61
|
+
Traces.trace("falcon.middleware.redirect.call", attributes: {authority: request.authority}) do
|
62
62
|
super
|
63
63
|
end
|
64
64
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "console"
|
7
|
+
require "async/http/statistics"
|
8
8
|
|
9
9
|
module Falcon
|
10
10
|
module Middleware
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2024, by Samuel Williams.
|
4
|
+
# Copyright, 2024-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
|
6
|
+
require_relative "../../falcon"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
require 'kernel/sync'
|
11
|
-
require 'io/endpoint/host_endpoint'
|
8
|
+
require "kernel/sync"
|
9
|
+
require "io/endpoint/host_endpoint"
|
12
10
|
|
13
11
|
module Falcon
|
14
12
|
module Rackup
|
@@ -25,7 +23,7 @@ module Falcon
|
|
25
23
|
# Generate an endpoint for the given `rackup` options.
|
26
24
|
# @returns [::IO::Endpoint::HostEndpoint]
|
27
25
|
def self.endpoint_for(**options)
|
28
|
-
host = options[:Host] ||
|
26
|
+
host = options[:Host] || "localhost"
|
29
27
|
port = Integer(options[:Port] || 9292)
|
30
28
|
|
31
29
|
return ::IO::Endpoint.tcp(host, port)
|
data/lib/falcon/server.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "async/http/server"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "protocol/http/middleware/builder"
|
9
|
+
require "protocol/http/content_encoding"
|
10
10
|
|
11
|
-
require
|
11
|
+
require "async/http/cache"
|
12
12
|
|
13
|
-
require_relative
|
14
|
-
require
|
13
|
+
require_relative "middleware/verbose"
|
14
|
+
require "protocol/rack"
|
15
15
|
|
16
16
|
module Falcon
|
17
17
|
# A server listening on a specific endpoint, hosting a specific middleware.
|
@@ -4,10 +4,10 @@
|
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2020, by Daniel Evans.
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require "async/service/generic"
|
8
|
+
require "async/http/endpoint"
|
9
9
|
|
10
|
-
require_relative
|
10
|
+
require_relative "../server"
|
11
11
|
|
12
12
|
module Falcon
|
13
13
|
module Service
|
@@ -3,13 +3,13 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "process/metrics"
|
7
|
+
require "json"
|
8
8
|
|
9
|
-
require
|
9
|
+
require "async/service/generic"
|
10
10
|
|
11
|
-
require
|
12
|
-
require
|
11
|
+
require "io/endpoint/bound_endpoint"
|
12
|
+
require "io/stream"
|
13
13
|
|
14
14
|
module Falcon
|
15
15
|
module Service
|
@@ -50,9 +50,9 @@ module Falcon
|
|
50
50
|
# @parameter message [Hash] The decoded message.
|
51
51
|
def handle(message)
|
52
52
|
case message[:please]
|
53
|
-
when
|
53
|
+
when "restart"
|
54
54
|
self.do_restart(message)
|
55
|
-
when
|
55
|
+
when "metrics"
|
56
56
|
self.do_metrics(message)
|
57
57
|
end
|
58
58
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "async/service/generic"
|
7
7
|
|
8
8
|
module Falcon
|
9
9
|
module Service
|
@@ -18,14 +18,14 @@ module Falcon
|
|
18
18
|
def assume_privileges(path)
|
19
19
|
# Process.exec / Process.spawn don't replace the environment but instead update it, so we need to clear out any existing BUNDLE_ variables using `nil` values, which will cause them to be removed from the child environment:
|
20
20
|
env = ENV.to_h do |key, value|
|
21
|
-
if key.start_with?(
|
21
|
+
if key.start_with?("BUNDLE_")
|
22
22
|
[key, nil]
|
23
23
|
else
|
24
24
|
[key, value]
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
env[
|
28
|
+
env["PWD"] = File.dirname(path)
|
29
29
|
|
30
30
|
stat = File.stat(path)
|
31
31
|
|
@@ -33,7 +33,7 @@ module Falcon
|
|
33
33
|
Process::UID.change_privilege(stat.uid)
|
34
34
|
|
35
35
|
home = Etc.getpwuid(stat.uid).dir
|
36
|
-
env[
|
36
|
+
env["HOME"] = home
|
37
37
|
|
38
38
|
return env
|
39
39
|
end
|
data/lib/falcon/version.rb
CHANGED
data/lib/rack/handler/falcon.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
# Copyright, 2019, by Bryan Powell.
|
6
6
|
|
7
|
-
require
|
7
|
+
require "rack/handler"
|
8
8
|
|
9
|
-
require_relative
|
9
|
+
require_relative "../../falcon/rackup/handler"
|
10
|
+
|
11
|
+
# Generally speaking, you should not require this file directly, or assume the existance of the `Rack::Handler::Falcon` constant. Instead, use `Rack::Handler.get(:falcon)` to load and access the handler.
|
10
12
|
|
11
13
|
module Rack
|
12
14
|
module Handler
|
13
|
-
|
14
|
-
|
15
|
+
# Rack (v2) expects the constant to be in the `Rack::Handler` namespace, so we define a new handler class in the `Rack::Handler` namespace that inherits from `Falcon::Rackup::Handler`.
|
16
|
+
class Falcon < ::Falcon::Rackup::Handler
|
17
|
+
end
|
18
|
+
|
19
|
+
# Rack (v2) expects a string for the handler constant name. `Falcon.to_s` returns a more human friendly name, so we explicitly pass `Falcon.name` to `register` to ensure Rack can find the handler using the registered name.
|
20
|
+
register :falcon, Falcon.name
|
15
21
|
end
|
16
22
|
end
|
@@ -1,15 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023-
|
4
|
+
# Copyright, 2023-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "rackup/handler"
|
7
7
|
|
8
|
-
require_relative
|
8
|
+
require_relative "../../falcon/rackup/handler"
|
9
|
+
|
10
|
+
# Generally speaking, you should not require this file directly, or assume the existance of the `Rackup::Handler::Falcon` constant. Instead, use `Rackup::Handler.get(:falcon)` to load and access the handler.
|
9
11
|
|
10
12
|
module Rackup
|
11
13
|
module Handler
|
12
|
-
|
14
|
+
# Sinatra (and possibly others) try to extract the name using the final part of the class path, so we define a new class in the `Rack::Handler` namespace that inherits from `Falcon::Rackup::Handler`, that follows that convention.
|
15
|
+
class Falcon < ::Falcon::Rackup::Handler
|
16
|
+
end
|
17
|
+
|
18
|
+
# Rack (v3) expects a class for the handler constant, so we explicitly pass `Falcon` to `register` to ensure Rack can find the handler using the registered name.
|
13
19
|
register :falcon, Falcon
|
14
20
|
end
|
15
21
|
end
|
data/license.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# MIT License
|
2
2
|
|
3
|
-
Copyright, 2017-
|
3
|
+
Copyright, 2017-2025, by Samuel Williams.
|
4
4
|
Copyright, 2018, by Kent Gruber.
|
5
5
|
Copyright, 2018, by Janko Marohnić.
|
6
6
|
Copyright, 2018, by Tad Thorley.
|
7
7
|
Copyright, 2018, by Mitsutaka Mimura.
|
8
8
|
Copyright, 2018, by Kyle Tam.
|
9
9
|
Copyright, 2018, by Claudiu Garba.
|
10
|
+
Copyright, 2018, by Martin Hrdlicka.
|
10
11
|
Copyright, 2019, by Bryan Powell.
|
11
12
|
Copyright, 2019, by Sh Lin.
|
12
13
|
Copyright, 2019, by Sho Ito.
|
13
14
|
Copyright, 2019, by Colby Swandale.
|
15
|
+
Copyright, 2019-2024, by dependabot[bot].
|
14
16
|
Copyright, 2020, by Daniel Evans.
|
15
17
|
Copyright, 2020, by Mikel Kew.
|
16
18
|
Copyright, 2020, by Michael Adams.
|
@@ -20,9 +22,9 @@ Copyright, 2023, by Nick Janetakis.
|
|
20
22
|
Copyright, 2024, by Peter Schrammel.
|
21
23
|
Copyright, 2024, by Santiago Bartesaghi.
|
22
24
|
Copyright, 2024, by Trevor Turk.
|
23
|
-
Copyright, 2024, by dependabot[bot].
|
24
25
|
Copyright, 2024, by Adam Daniels.
|
25
26
|
Copyright, 2024, by Stefan Buhrmester.
|
27
|
+
Copyright, 2024, by Ismael Celis.
|
26
28
|
|
27
29
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
28
30
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -45,6 +45,10 @@ Please see the [project documentation](https://socketry.github.io/falcon/) for m
|
|
45
45
|
|
46
46
|
Please see the [project releases](https://socketry.github.io/falcon/releases/index) for all releases.
|
47
47
|
|
48
|
+
### v0.48.4
|
49
|
+
|
50
|
+
- Improve compatibility of rackup handler w.r.t. sinatra.
|
51
|
+
|
48
52
|
### v0.47.8
|
49
53
|
|
50
54
|
- Fix Falcon Supervisor implementation: due to invalid code, it was unable to start.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
�ڨ�a��Z��>E����|�����E��7$Ȭ���%bp^O�J��|ȵ~���o�p�@�Á!O/4�L�RW���a���'�/����V�aۉH�u�s��^i���N ĶE��kE�(��0hy�ّ��d*:g%]�*�x?�K��f����V��Cb����EV,l���U��/�j��Z`B�2X�S����,�Wc�T��ւ �v�f�28I���#@��������<����qF�mx�{cBd�,ú�e��W�m8$:�~Qv���:F�8�����M4��������:�R�������[�LB��F�h�[5ٖ�ׂ�ٌ."=Y�2ne��Ӌ��j爌�F�D���]�) ���@�`�'��
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.48.
|
4
|
+
version: 0.48.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- dependabot[bot]
|
8
9
|
- Janko Marohnić
|
9
10
|
- Bryan Powell
|
10
11
|
- Trevor Turk
|
@@ -16,7 +17,9 @@ authors:
|
|
16
17
|
- Adam Daniels
|
17
18
|
- Colby Swandale
|
18
19
|
- Daniel Evans
|
20
|
+
- Ismael Celis
|
19
21
|
- Kent Gruber
|
22
|
+
- Martin Hrdlicka
|
20
23
|
- Michael Adams
|
21
24
|
- Mikel Kew
|
22
25
|
- Nick Janetakis
|
@@ -26,7 +29,6 @@ authors:
|
|
26
29
|
- Stefan Buhrmester
|
27
30
|
- Tad Thorley
|
28
31
|
- Tasos Latsas
|
29
|
-
- dependabot[bot]
|
30
32
|
autorequire:
|
31
33
|
bindir: bin
|
32
34
|
cert_chain:
|
@@ -59,7 +61,7 @@ cert_chain:
|
|
59
61
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
60
62
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
61
63
|
-----END CERTIFICATE-----
|
62
|
-
date:
|
64
|
+
date: 2025-01-04 00:00:00.000000000 Z
|
63
65
|
dependencies:
|
64
66
|
- !ruby/object:Gem::Dependency
|
65
67
|
name: async
|
@@ -174,33 +176,33 @@ dependencies:
|
|
174
176
|
- !ruby/object:Gem::Version
|
175
177
|
version: '3.0'
|
176
178
|
- !ruby/object:Gem::Dependency
|
177
|
-
name:
|
179
|
+
name: process-metrics
|
178
180
|
requirement: !ruby/object:Gem::Requirement
|
179
181
|
requirements:
|
180
182
|
- - "~>"
|
181
183
|
- !ruby/object:Gem::Version
|
182
|
-
version: '0.
|
184
|
+
version: '0.2'
|
183
185
|
type: :runtime
|
184
186
|
prerelease: false
|
185
187
|
version_requirements: !ruby/object:Gem::Requirement
|
186
188
|
requirements:
|
187
189
|
- - "~>"
|
188
190
|
- !ruby/object:Gem::Version
|
189
|
-
version: '0.
|
191
|
+
version: '0.2'
|
190
192
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
193
|
+
name: protocol-http
|
192
194
|
requirement: !ruby/object:Gem::Requirement
|
193
195
|
requirements:
|
194
196
|
- - "~>"
|
195
197
|
- !ruby/object:Gem::Version
|
196
|
-
version: '0.
|
198
|
+
version: '0.31'
|
197
199
|
type: :runtime
|
198
200
|
prerelease: false
|
199
201
|
version_requirements: !ruby/object:Gem::Requirement
|
200
202
|
requirements:
|
201
203
|
- - "~>"
|
202
204
|
- !ruby/object:Gem::Version
|
203
|
-
version: '0.
|
205
|
+
version: '0.31'
|
204
206
|
- !ruby/object:Gem::Dependency
|
205
207
|
name: protocol-rack
|
206
208
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
306
|
- !ruby/object:Gem::Version
|
305
307
|
version: '0'
|
306
308
|
requirements: []
|
307
|
-
rubygems_version: 3.5.
|
309
|
+
rubygems_version: 3.5.22
|
308
310
|
signing_key:
|
309
311
|
specification_version: 4
|
310
312
|
summary: A fast, asynchronous, rack-compatible web server.
|
metadata.gz.sig
CHANGED
Binary file
|