falcon 0.40.0 → 0.40.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/falcon/extensions/openssl.rb +9 -7
- data/lib/falcon/services.rb +2 -2
- data/lib/falcon/version.rb +1 -1
- data/lib/rack/handler/falcon.rb +48 -13
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 94f85c9e2ed95f6a43fda46cc07a986436ec7d874294b28288bcb004d269ea3c
|
4
|
+
data.tar.gz: f56850aab821d12cd73cdc1545ad2691bce81d1121ae543feb3d29f6e8ae28da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047ac6d846d54362c8cc220f0264c60f9c951c557a61ca9c34636a93198acf04ab1b6e0b7ff10a684a8700f4b6a158dd57abf453cfa71bd5e9dee949eeedccdf
|
7
|
+
data.tar.gz: 425b8131c9cbbe18684492213351e480a42d8037fc198c234ce7cd19e5f3f61b5bf59145b8335e8508928ee766ddcbff8992925084c2f5dbd5cfe1f0207de03b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -22,13 +22,15 @@
|
|
22
22
|
|
23
23
|
require 'openssl/x509'
|
24
24
|
|
25
|
-
module OpenSSL
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
data/lib/falcon/services.rb
CHANGED
data/lib/falcon/version.rb
CHANGED
data/lib/rack/handler/falcon.rb
CHANGED
@@ -4,16 +4,16 @@ require 'rack/handler'
|
|
4
4
|
|
5
5
|
require_relative '../../falcon'
|
6
6
|
|
7
|
-
require '
|
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
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
78
|
+
|
79
|
+
register :falcon, Falcon
|
45
80
|
end
|
46
81
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.40.
|
4
|
+
version: 0.40.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -53,7 +53,7 @@ cert_chain:
|
|
53
53
|
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
54
54
|
HiLJ8VOFx6w=
|
55
55
|
-----END CERTIFICATE-----
|
56
|
-
date: 2022-07-
|
56
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
57
57
|
dependencies:
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: async
|
metadata.gz.sig
CHANGED
Binary file
|