falcon 0.38.0 → 0.38.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5a4201cd601d651d96edf8c9eee196033ce1e1d31a802d16619a986dd1bd077
4
- data.tar.gz: 9b1c9d31622951486ea1d1db012074551cb18ed4ff785d8dbb37bfa1b75dc046
3
+ metadata.gz: 528715bbefa4d1a6ac67c1ee8cf3776ba2e5dbd30b55cf1a7f8cac24b8644e03
4
+ data.tar.gz: dbaa0c70e17e2c1e2dbd29f21cad6ac64d7959685847341d7bfb5e69c0867f08
5
5
  SHA512:
6
- metadata.gz: 9f1cd7757afa92a27b7b9d021e2ff443144afef2c9b0e30bddad548b45e68b4519ab02f2293f6388a00f62af0e8efb865e51f1241b8cee9312f9187406cb86ed
7
- data.tar.gz: a75c84be6f77e4e79aa6d572d1a95e7c90d310650324f8d60fbca4dcd679138e30e799b538184ff804bfeac6c351478e574f61670d4e1d568801166ce24ac2ea
6
+ metadata.gz: c793d6ea24c5ddbe15e157d9958f62b0d88529beb79547d72744a93bf51ecafe7693ab54c9aaaba576d8c502b639744c6309faf97ceeeb271addf9b7ee86ea69
7
+ data.tar.gz: bbe4e7e16a0a937d2564771cd4503436302236e0b87d65813767b056da34d58a15808917b57cf4e602fec02faff53158f385e850ab3799dc561b79e797857cdb
data/bin/falcon CHANGED
@@ -27,6 +27,6 @@ begin
27
27
  rescue Interrupt
28
28
  # Ignore.
29
29
  rescue => error
30
- Async.logger.error(Falcon::Command) {error}
30
+ Console.logger.error(Falcon::Command) {error}
31
31
  exit! 1
32
32
  end
@@ -25,7 +25,7 @@ require 'rack'
25
25
  require_relative 'input'
26
26
  require_relative 'response'
27
27
 
28
- require 'async/logger'
28
+ require 'console'
29
29
 
30
30
  module Falcon
31
31
  module Adapters
@@ -74,13 +74,10 @@ module Falcon
74
74
 
75
75
  # Initialize the rack adaptor middleware.
76
76
  # @parameter app [Object] The rack middleware.
77
- # @parameter logger [Console::Logger] The logger to use.
78
- def initialize(app, logger = Async.logger)
77
+ def initialize(app)
79
78
  @app = app
80
79
 
81
80
  raise ArgumentError, "App must be callable!" unless @app.respond_to?(:call)
82
-
83
- @logger = logger
84
81
  end
85
82
 
86
83
  # Unwrap raw HTTP headers into the CGI-style expected by Rack middleware.
@@ -150,7 +147,7 @@ module Falcon
150
147
 
151
148
  RACK_INPUT => Input.new(request.body),
152
149
  RACK_ERRORS => $stderr,
153
- RACK_LOGGER => Async.logger,
150
+ RACK_LOGGER => Console.logger,
154
151
 
155
152
  RACK_MULTITHREAD => true,
156
153
  RACK_MULTIPROCESS => true,
@@ -211,7 +208,7 @@ module Falcon
211
208
  return Response.wrap(status, headers, body, request)
212
209
  end
213
210
  rescue => exception
214
- @logger.error(self) {exception}
211
+ Console.logger.error(self) {exception}
215
212
 
216
213
  return failure_response(exception)
217
214
  end
@@ -78,7 +78,7 @@ module Falcon
78
78
  ignored = headers.extract(IGNORE_HEADERS)
79
79
 
80
80
  unless ignored.empty?
81
- Async.logger.warn("Ignoring protocol-level headers: #{ignored.inspect}")
81
+ Console.logger.warn("Ignoring protocol-level headers: #{ignored.inspect}")
82
82
  end
83
83
 
84
84
  body = Output.wrap(status, headers, body)
@@ -64,7 +64,7 @@ module Falcon
64
64
 
65
65
  # Prepare the environment and run the controller.
66
66
  def call
67
- Async.logger.info(self) do |buffer|
67
+ Console.logger.info(self) do |buffer|
68
68
  buffer.puts "Falcon Host v#{VERSION} taking flight!"
69
69
  buffer.puts "- Configuration: #{@paths.join(', ')}"
70
70
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -66,7 +66,7 @@ module Falcon
66
66
 
67
67
  # Prepare the environment and run the controller.
68
68
  def call
69
- Async.logger.info(self) do |buffer|
69
+ Console.logger.info(self) do |buffer|
70
70
  buffer.puts "Falcon Proxy v#{VERSION} taking flight!"
71
71
  buffer.puts "- Binding to: #{@options[:bind]}"
72
72
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -64,7 +64,7 @@ module Falcon
64
64
 
65
65
  # Prepare the environment and run the controller.
66
66
  def call
67
- Async.logger.info(self) do |buffer|
67
+ Console.logger.info(self) do |buffer|
68
68
  buffer.puts "Falcon Redirect v#{VERSION} taking flight!"
69
69
  buffer.puts "- Binding to: #{@options[:bind]}"
70
70
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -133,7 +133,7 @@ module Falcon
133
133
 
134
134
  # Prepare the environment and run the controller.
135
135
  def call
136
- Async.logger.info(self) do |buffer|
136
+ Console.logger.info(self) do |buffer|
137
137
  buffer.puts "Falcon v#{VERSION} taking flight! Using #{self.container_class} #{self.container_options}."
138
138
  buffer.puts "- Binding to: #{self.endpoint}"
139
139
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -71,7 +71,7 @@ module Falcon
71
71
 
72
72
  # Prepare the environment and run the controller.
73
73
  def call
74
- Async.logger.info(self) do |buffer|
74
+ Console.logger.info(self) do |buffer|
75
75
  buffer.puts "Falcon Virtual v#{VERSION} taking flight!"
76
76
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
77
77
  buffer.puts "- To reload all sites: kill -HUP #{Process.pid}"
@@ -60,13 +60,13 @@ module Falcon
60
60
  # @parameter hostname [String] The negotiated hostname.
61
61
  def host_context(socket, hostname)
62
62
  if host = @hosts[hostname]
63
- Async.logger.debug(self) {"Resolving #{hostname} -> #{host}"}
63
+ Console.logger.debug(self) {"Resolving #{hostname} -> #{host}"}
64
64
 
65
65
  socket.hostname = hostname
66
66
 
67
67
  return host.ssl_context
68
68
  else
69
- Async.logger.warn(self) {"Unable to resolve #{hostname}!"}
69
+ Console.logger.warn(self) {"Unable to resolve #{hostname}!"}
70
70
 
71
71
  return nil
72
72
  end
@@ -110,7 +110,7 @@ module Falcon
110
110
 
111
111
  services.each do |service|
112
112
  if service.is_a?(Service::Proxy)
113
- Async.logger.info(self) {"Proxying #{service.authority} to #{service.endpoint}"}
113
+ Console.logger.info(self) {"Proxying #{service.authority} to #{service.endpoint}"}
114
114
  @hosts[service.authority] = service
115
115
 
116
116
  # Pre-cache the ssl contexts:
@@ -68,7 +68,7 @@ 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}" }
71
+ Console.logger.info(self) { "Starting #{name} on #{@endpoint.to_url}" }
72
72
 
73
73
  @debug_trap.ignore!
74
74
 
@@ -90,13 +90,13 @@ module Falcon
90
90
 
91
91
  task.async do
92
92
  if @debug_trap.install!
93
- Async.logger.info(instance) do
93
+ Console.logger.info(instance) do
94
94
  "- Per-process status: kill -USR1 #{Process.pid}"
95
95
  end
96
96
  end
97
97
 
98
98
  @debug_trap.trap do
99
- Async.logger.info(self) do |buffer|
99
+ Console.logger.info(self) do |buffer|
100
100
  task.reactor.print_hierarchy(buffer)
101
101
  end
102
102
  end
@@ -112,7 +112,7 @@ module Falcon
112
112
  def prepare_request(request, host)
113
113
  forwarded = []
114
114
 
115
- Async.logger.debug(self) do |buffer|
115
+ Console.logger.debug(self) do |buffer|
116
116
  buffer.puts "Request authority: #{request.authority}"
117
117
  buffer.puts "Host authority: #{host.authority}"
118
118
  buffer.puts "Request: #{request.method} #{request.path} #{request.version}"
@@ -158,7 +158,7 @@ module Falcon
158
158
  super
159
159
  end
160
160
  rescue
161
- Async.logger.error(self) {$!}
161
+ Console.logger.error(self) {$!}
162
162
  return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, ["#{$!.inspect}: #{$!.backtrace.join("\n")}"]]
163
163
  end
164
164
  end
@@ -20,7 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require 'async/logger'
23
+ require 'console'
24
24
  require 'async/http/statistics'
25
25
 
26
26
  module Falcon
@@ -30,7 +30,7 @@ module Falcon
30
30
  # Initialize the verbose middleware.
31
31
  # @parameter app [Protocol::HTTP::Middleware] The middleware to wrap.
32
32
  # @parameter logger [Console::Logger] The logger to use.
33
- def initialize(app, logger = Async.logger)
33
+ def initialize(app, logger = Console.logger)
34
34
  super(app)
35
35
 
36
36
  @logger = logger
@@ -52,7 +52,7 @@ module Falcon
52
52
  def preload!
53
53
  if scripts = @evaluator.preload
54
54
  scripts.each do |path|
55
- Async.logger.info(self) {"Preloading #{path}..."}
55
+ Console.logger.info(self) {"Preloading #{path}..."}
56
56
  full_path = File.expand_path(path, self.root)
57
57
  load(full_path)
58
58
  end
@@ -62,7 +62,7 @@ module Falcon
62
62
  # Prepare the bound endpoint for the application instances.
63
63
  # Invoke {preload!} to load shared resources into the parent process.
64
64
  def start
65
- Async.logger.info(self) {"Binding to #{self.endpoint}..."}
65
+ Console.logger.info(self) {"Binding to #{self.endpoint}..."}
66
66
 
67
67
  @bound_endpoint = Async::Reactor.run do
68
68
  Async::IO::SharedEndpoint.bound(self.endpoint)
@@ -87,8 +87,8 @@ module Falcon
87
87
  run_options[:count] = count unless count.nil?
88
88
 
89
89
  container.run(**run_options) do |instance|
90
- Async(logger: logger) do |task|
91
- Async.logger.info(self) {"Starting application server for #{self.root}..."}
90
+ Async do |task|
91
+ Console.logger.info(self) {"Starting application server for #{self.root}..."}
92
92
 
93
93
  server = Server.new(self.middleware, @bound_endpoint, protocol: protocol, scheme: scheme)
94
94
 
@@ -58,7 +58,7 @@ module Falcon
58
58
  # The logger to use for this service.
59
59
  # @returns [Console::Logger]
60
60
  def logger
61
- return Async.logger # .with(name: name)
61
+ return Console.logger # .with(name: name)
62
62
  end
63
63
 
64
64
  # Start the service.
@@ -74,7 +74,7 @@ module Falcon
74
74
 
75
75
  # Bind the supervisor to the specified endpoint.
76
76
  def start
77
- Async.logger.info(self) {"Binding to #{self.endpoint}..."}
77
+ Console.logger.info(self) {"Binding to #{self.endpoint}..."}
78
78
 
79
79
  @bound_endpoint = Async::Reactor.run do
80
80
  Async::IO::SharedEndpoint.bound(self.endpoint)
@@ -61,7 +61,7 @@ module Falcon
61
61
  # Start all named services.
62
62
  def start
63
63
  @named.each do |name, service|
64
- Async.logger.debug(self) {"Starting #{name}..."}
64
+ Console.logger.debug(self) {"Starting #{name}..."}
65
65
  service.start
66
66
  end
67
67
  end
@@ -71,7 +71,7 @@ module Falcon
71
71
  # @parameter container [Async::Container::Generic]
72
72
  def setup(container)
73
73
  @named.each do |name, service|
74
- Async.logger.debug(self) {"Setup #{name} into #{container}..."}
74
+ Console.logger.debug(self) {"Setup #{name} into #{container}..."}
75
75
  service.setup(container)
76
76
  end
77
77
 
@@ -83,13 +83,13 @@ module Falcon
83
83
  failed = false
84
84
 
85
85
  @named.each do |name, service|
86
- Async.logger.debug(self) {"Stopping #{name}..."}
86
+ Console.logger.debug(self) {"Stopping #{name}..."}
87
87
 
88
88
  begin
89
89
  service.stop
90
90
  rescue
91
91
  failed = true
92
- Async.logger.error(self, $!)
92
+ Console.logger.error(self, $!)
93
93
  end
94
94
  end
95
95
 
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Falcon
24
- VERSION = "0.38.0"
24
+ VERSION = "0.38.1"
25
25
  end
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.38.0
4
+ version: 0.38.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-23 00:00:00.000000000 Z
11
+ date: 2021-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -322,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  - !ruby/object:Gem::Version
323
323
  version: '0'
324
324
  requirements: []
325
- rubygems_version: 3.1.2
325
+ rubygems_version: 3.2.3
326
326
  signing_key:
327
327
  specification_version: 4
328
328
  summary: A fast, asynchronous, rack-compatible web server.