falcon 0.39.1 → 0.40.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: 0dca89c2661bf0bacad2565bb1f086594cd0a316c8ab24d7418b6a7e1e264d59
4
- data.tar.gz: 9fa11ef82665f645bfc18d2f8ec443aea638ad858e40f935a073a0dabb6e2747
3
+ metadata.gz: 94f85c9e2ed95f6a43fda46cc07a986436ec7d874294b28288bcb004d269ea3c
4
+ data.tar.gz: f56850aab821d12cd73cdc1545ad2691bce81d1121ae543feb3d29f6e8ae28da
5
5
  SHA512:
6
- metadata.gz: db9784ff74606b045ac17780ea57adeca95f540bc513a2a39274618638433403927a601189c941f5b400e0b822ee386ef9133f8e376a173859d62a72ea834e05
7
- data.tar.gz: 51272baa0cbbe7e4293c24b80a5121b941b8203d2cce1ab811811480a101b3a81c6312772794769bc54ba842cf381c0d1e25636489b803b5ac0cb4ac988dd257
6
+ metadata.gz: 047ac6d846d54362c8cc220f0264c60f9c951c557a61ca9c34636a93198acf04ab1b6e0b7ff10a684a8700f4b6a158dd57abf453cfa71bd5e9dee949eeedccdf
7
+ data.tar.gz: 425b8131c9cbbe18684492213351e480a42d8037fc198c234ce7cd19e5f3f61b5bf59145b8335e8508928ee766ddcbff8992925084c2f5dbd5cfe1f0207de03b
checksums.yaml.gz.sig ADDED
Binary file
@@ -78,7 +78,7 @@ module Falcon
78
78
 
79
79
  # Whether the body can be read immediately.
80
80
  def ready?
81
- true
81
+ body.is_a?(Array) or body.respond_to?(:to_ary)
82
82
  end
83
83
 
84
84
  # Close the response body.
@@ -22,13 +22,15 @@
22
22
 
23
23
  require 'openssl/x509'
24
24
 
25
- module OpenSSL::X509
26
- CERTIFICATE_PATTERN = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
27
-
28
- # An extension to load an array of certificates from a file at the given path.
29
- def self.load_certificates(path)
30
- File.read(path).scan(CERTIFICATE_PATTERN).collect do |text|
31
- Certificate.new(text)
25
+ module OpenSSL
26
+ module X509
27
+ CERTIFICATE_PATTERN = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
28
+
29
+ # An extension to load an array of certificates from a file at the given path.
30
+ def self.load_certificates(path)
31
+ File.read(path).scan(CERTIFICATE_PATTERN).collect do |text|
32
+ Certificate.new(text)
33
+ end
32
34
  end
33
35
  end
34
36
  end
@@ -87,9 +87,9 @@ module Falcon
87
87
 
88
88
  begin
89
89
  service.stop
90
- rescue
90
+ rescue => error
91
91
  failed = true
92
- Console.logger.error(self, $!)
92
+ Console.logger.error(self, error)
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.39.1"
24
+ VERSION = "0.40.1"
25
25
  end
@@ -4,16 +4,16 @@ require 'rack/handler'
4
4
 
5
5
  require_relative '../../falcon'
6
6
 
7
- require 'async/reactor'
7
+ require 'kernel/sync'
8
8
  require 'async/io/host_endpoint'
9
+ require 'async/io/notification'
9
10
 
10
11
  module Rack
11
12
  module Handler
12
13
  # The falcon adaptor for the `rackup` executable.
13
- module Falcon
14
+ class Falcon
14
15
  # The default scheme.
15
16
  SCHEME = "http"
16
- NAME = :falcon
17
17
 
18
18
  # Generate an endpoint for the given `rackup` options.
19
19
  # @returns [Async::IO::Endpoint]
@@ -27,20 +27,55 @@ module Rack
27
27
  # Run the specified app using the given options:
28
28
  # @parameter app [Object] The rack middleware.
29
29
  def self.run(app, **options)
30
- endpoint = endpoint_for(**options)
31
-
32
30
  app = ::Falcon::Adapters::Rack.new(app)
33
31
  app = ::Falcon::Adapters::Rewindable.new(app)
34
-
35
- server = ::Falcon::Server.new(app, endpoint, protocol: Async::HTTP::Protocol::HTTP1, scheme: SCHEME)
36
- yield server if block_given?
37
-
38
- Async::Reactor.run do
39
- server.run
32
+
33
+ Sync do |task|
34
+ endpoint = endpoint_for(**options)
35
+ server = ::Falcon::Server.new(app, endpoint, protocol: Async::HTTP::Protocol::HTTP1, scheme: SCHEME)
36
+
37
+ server_task = task.async do
38
+ server.run.each(&:wait)
39
+ end
40
+
41
+ wrapper = self.new(server, task)
42
+
43
+ yield wrapper if block_given?
44
+
45
+ server_task.wait
46
+ ensure
47
+ server_task.stop
48
+ wrapper.close
49
+ end
50
+ end
51
+
52
+ def initialize(server, task)
53
+ @server = server
54
+ @task = task
55
+
56
+ @notification = Async::IO::Notification.new
57
+
58
+ @waiter = @task.async(transient: true) do
59
+ @notification.wait
60
+
61
+ @task&.stop
62
+ @task = nil
40
63
  end
41
64
  end
65
+
66
+ def stop
67
+ @notification&.signal
68
+ end
69
+
70
+ def close
71
+ @notification&.close
72
+ @notification = nil
73
+
74
+ @waiter&.stop
75
+ @waiter = nil
76
+ end
42
77
  end
43
-
44
- register Falcon::NAME, Falcon
78
+
79
+ register :falcon, Falcon
45
80
  end
46
81
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,29 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.1
4
+ version: 0.40.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Janko Marohnić
9
+ - dependabot[bot]
10
+ - Bryan Powell
11
+ - Sho Ito
12
+ - claudiu
13
+ - takkanm
14
+ - tamkylet
15
+ - Colby Swandale
16
+ - Daniel Evans
17
+ - Kent Gruber
18
+ - Michael Adams
19
+ - Mikel Kew
20
+ - Olle Jonsson
21
+ - Sh Lin
22
+ - Tad Thorley
23
+ - Tasos Latsas
24
+ - deepj
8
25
  autorequire:
9
26
  bindir: bin
10
- cert_chain: []
11
- date: 2021-06-05 00:00:00.000000000 Z
27
+ cert_chain:
28
+ - |
29
+ -----BEGIN CERTIFICATE-----
30
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
31
+ ZWwud2lsbGlhbXMvREM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ho//4oAu6T
47
+ 9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
48
+ vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
49
+ x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
50
+ bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
51
+ Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
52
+ y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
53
+ RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
54
+ HiLJ8VOFx6w=
55
+ -----END CERTIFICATE-----
56
+ date: 2022-07-19 00:00:00.000000000 Z
12
57
  dependencies:
13
58
  - !ruby/object:Gem::Dependency
14
59
  name: async
15
60
  requirement: !ruby/object:Gem::Requirement
16
61
  requirements:
17
- - - "~>"
62
+ - - ">="
18
63
  - !ruby/object:Gem::Version
19
- version: '1.13'
64
+ version: '0'
20
65
  type: :runtime
21
66
  prerelease: false
22
67
  version_requirements: !ruby/object:Gem::Requirement
23
68
  requirements:
24
- - - "~>"
69
+ - - ">="
25
70
  - !ruby/object:Gem::Version
26
- version: '1.13'
71
+ version: '0'
27
72
  - !ruby/object:Gem::Dependency
28
73
  name: async-container
29
74
  requirement: !ruby/object:Gem::Requirement
@@ -322,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
367
  - !ruby/object:Gem::Version
323
368
  version: '0'
324
369
  requirements: []
325
- rubygems_version: 3.2.15
370
+ rubygems_version: 3.3.7
326
371
  signing_key:
327
372
  specification_version: 4
328
373
  summary: A fast, asynchronous, rack-compatible web server.
metadata.gz.sig ADDED
Binary file