falcon 0.32.0 → 0.32.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: 19fc217c5ab4d9c7e1b888d46366843e3d549c4d771cec14f0f17a4578144be8
4
- data.tar.gz: fbb6d14f55d0fb392a98edcc4381a54db624376e3d40d0a5db4ba70ae9ccb9e4
3
+ metadata.gz: c80289856ac260e9a3e423465926308c76630cdb6d9d6940f147e2f643af638a
4
+ data.tar.gz: 0dc95d7527f64b6bc8ae6de7bfaa5f9eb5c36c26a40d6b4d318d2c63a354f4c2
5
5
  SHA512:
6
- metadata.gz: 8a66a5a99d8902246e058565ee11023fad33dfe8a5909271e3536d43cc6a5d439b664142df4a82c83791f04ea86a631ea06f957fdf18b181818af8a6871d688e
7
- data.tar.gz: 23c44cee1313788820af52e6787efe5157a7d228bd7032b77125a6f6d226d72576bf32073c35cdf78a1db05a466457ea14685dc110766eddbbe29950894857e3
6
+ metadata.gz: 8cde639a3858513ccdd80c8192d9158f75973375ecf2d66b468d18943da3e6f490cb9edaf3c94cb96b5494e140287c71545f41c806fbd4bba28e88f5f77ad43a
7
+ data.tar.gz: edb463f74426954aa1a71788060cdda534d4ce9ae147a4f42899f1251e669644ed5be5ab4e9e22d7f17f24158d4d9ffedc1659f38a4cbaa3c0d3695a41961fa6
data/falcon.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "async", "~> 1.13"
23
23
  spec.add_dependency "async-io", "~> 1.22"
24
24
  spec.add_dependency "async-http", "~> 0.43.0"
25
- spec.add_dependency "async-container", "~> 0.12.0"
25
+ spec.add_dependency "async-container", "~> 0.14.0"
26
26
 
27
27
  spec.add_dependency "rack", ">= 1.0"
28
28
 
@@ -69,7 +69,7 @@ module Falcon
69
69
 
70
70
  container = run(container, parent.verbose?)
71
71
 
72
- container.wait
72
+ container.wait(true)
73
73
  end
74
74
  end
75
75
  end
@@ -119,6 +119,10 @@ module Falcon
119
119
 
120
120
  container = container_class.new
121
121
 
122
+ container.attach do
123
+ bound_endpoint.close
124
+ end
125
+
122
126
  container.run(name: "Falcon Server", restart: true, **container_options) do |task, instance|
123
127
  task.async do
124
128
  if debug_trap.install!
@@ -0,0 +1,98 @@
1
+ # Copyright, 2018, 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/io/endpoint'
22
+
23
+ require_relative 'proxy'
24
+ require_relative 'redirection'
25
+
26
+ require 'async/container'
27
+ require 'async/container/controller'
28
+ require 'async/http/endpoint'
29
+
30
+ module Falcon
31
+ class Host
32
+ def initialize(environment)
33
+ @environment = environment.flatten
34
+ @evaluator = @environment.evaluator
35
+ end
36
+
37
+ def name
38
+ "Falcon Host for #{self.authority}"
39
+ end
40
+
41
+ def authority
42
+ @evaluator.authority
43
+ end
44
+
45
+ def endpoint
46
+ @evaluator.endpoint
47
+ end
48
+
49
+ def ssl_context
50
+ @evaluator.ssl_context
51
+ end
52
+
53
+ def root
54
+ @evaluator.root
55
+ end
56
+
57
+ def bound_endpoint
58
+ @evaluator.bound_endpoint
59
+ end
60
+
61
+ def to_s
62
+ "\#<#{self.class} #{@evaluator.authority}>"
63
+ end
64
+
65
+ def assume_privileges(path)
66
+ stat = File.stat(path)
67
+
68
+ Process::GID.change_privilege(stat.gid)
69
+ Process::UID.change_privilege(stat.uid)
70
+ end
71
+
72
+ def spawn(container)
73
+ container.spawn(name: self.name, restart: true) do |instance|
74
+ path = File.join(self.root, "falcon.rb")
75
+
76
+ assume_privileges(path)
77
+
78
+ instance.exec("bundle", "exec", path)
79
+ end
80
+ end
81
+
82
+ def run(container)
83
+ if @environment.include?(:server)
84
+ bound_endpoint = self.bound_endpoint
85
+
86
+ container.run(name: self.name, restart: true) do |task, instance|
87
+ Async.logger.info(self) {"Starting application server..."}
88
+
89
+ server = @evaluator.server
90
+
91
+ server.run
92
+
93
+ task.children.each(&:wait)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
data/lib/falcon/hosts.rb CHANGED
@@ -20,6 +20,7 @@
20
20
 
21
21
  require 'async/io/endpoint'
22
22
 
23
+ require_relative 'host'
23
24
  require_relative 'proxy'
24
25
  require_relative 'redirection'
25
26
 
@@ -28,74 +29,6 @@ require 'async/container/controller'
28
29
  require 'async/http/endpoint'
29
30
 
30
31
  module Falcon
31
- class Host
32
- def initialize(environment)
33
- @environment = environment.flatten
34
- @evaluator = @environment.evaluator
35
- end
36
-
37
- def name
38
- "Falcon Host for #{self.authority}"
39
- end
40
-
41
- def authority
42
- @evaluator.authority
43
- end
44
-
45
- def endpoint
46
- @evaluator.endpoint
47
- end
48
-
49
- def ssl_context
50
- @evaluator.ssl_context
51
- end
52
-
53
- def root
54
- @evaluator.root
55
- end
56
-
57
- def bound_endpoint
58
- @evaluator.bound_endpoint
59
- end
60
-
61
- def to_s
62
- "\#<#{self.class} #{@evaluator.authority}>"
63
- end
64
-
65
- def assume_privileges(path)
66
- stat = File.stat(path)
67
-
68
- Process::GID.change_privilege(stat.gid)
69
- Process::UID.change_privilege(stat.uid)
70
- end
71
-
72
- def spawn(container)
73
- container.spawn(name: self.name, restart: true) do |instance|
74
- path = File.join(self.root, "falcon.rb")
75
-
76
- assume_privileges(path)
77
-
78
- instance.exec("bundle", "exec", path)
79
- end
80
- end
81
-
82
- def run(container)
83
- if @environment.include?(:server)
84
- bound_endpoint = self.bound_endpoint
85
-
86
- container.run(name: self.name, restart: true) do |task, instance|
87
- Async.logger.info(self) {"Starting application server..."}
88
-
89
- server = @evaluator.server
90
-
91
- server.run
92
-
93
- task.children.each(&:wait)
94
- end
95
- end
96
- end
97
- end
98
-
99
32
  class Hosts
100
33
  DEFAULT_ALPN_PROTOCOLS = ['h2', 'http/1.1'].freeze
101
34
  SERVER_CIPHERS = "EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5".freeze
@@ -166,7 +99,7 @@ module Falcon
166
99
  Redirection.new(Falcon::BadRequest, @named, secure_endpoint)
167
100
  end
168
101
 
169
- def run(container = Async::Container::Forked.new, **options)
102
+ def run(container = Async::Container.new, **options)
170
103
  @named.each do |name, host|
171
104
  host.spawn(container)
172
105
  end
@@ -197,6 +130,11 @@ module Falcon
197
130
  redirection_server.run
198
131
  end
199
132
 
133
+ container.attach do
134
+ secure_endpoint_bound.close
135
+ insecure_endpoint_bound.close
136
+ end
137
+
200
138
  return container
201
139
  end
202
140
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.32.0"
22
+ VERSION = "0.32.1"
23
23
  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.32.0
4
+ version: 0.32.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: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2019-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.12.0
61
+ version: 0.14.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.12.0
68
+ version: 0.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -283,6 +283,7 @@ files:
283
283
  - lib/falcon/command/virtual.rb
284
284
  - lib/falcon/configuration.rb
285
285
  - lib/falcon/endpoint.rb
286
+ - lib/falcon/host.rb
286
287
  - lib/falcon/hosts.rb
287
288
  - lib/falcon/proxy.rb
288
289
  - lib/falcon/redirection.rb