falcon 0.17.6 → 0.18.0
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
- data/README.md +2 -2
- data/falcon.gemspec +2 -1
- data/lib/falcon/command/serve.rb +14 -9
- data/lib/falcon/endpoint.rb +55 -0
- data/lib/falcon/version.rb +1 -1
- data/logo.svg +82 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a05cee4c0a85b523432d1a2f50f094cadb7182a1c3a3dc6f643af3185079e4
|
4
|
+
data.tar.gz: e3a023a5752cb1f03e6a9fe9c9578dcedc1f497437e4886e385f10b958d18de9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eaeb43379eda8bb633bbb07cf17a686bd05e6e9c0e917211b859f81abdd58e211647a4f7251b7264e67d503062ed58eed486a353d3d0b2aa1973f0098a8cde7
|
7
|
+
data.tar.gz: 25a2a02e1c3bcec504148c89e5f850f5977edccb2b87373eb5325dbc6271063507a67323596ad8f637b7b6e35ca18adf94873768b617ac5f31db77be2ced1f02
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# Falcon
|
1
|
+
# 
|
2
2
|
|
3
|
-
|
3
|
+
Falcon is a multi-process, multi-fiber Rack HTTP server built on top of [async], [async-io] and [async-http]. Each request is run within a light weight fiber and can block on up-stream requests without stalling the entire server process. Supports HTTP/1 and HTTP/2 natively.
|
4
4
|
|
5
5
|
[](http://travis-ci.org/socketry/falcon)
|
6
6
|
[](https://codeclimate.com/github/socketry/falcon)
|
data/falcon.gemspec
CHANGED
@@ -17,12 +17,13 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_dependency("async-io", "~> 1.9")
|
20
|
-
spec.add_dependency("async-http", "~> 0.
|
20
|
+
spec.add_dependency("async-http", "~> 0.29.0")
|
21
21
|
spec.add_dependency("async-container", "~> 0.5.0")
|
22
22
|
|
23
23
|
spec.add_dependency("rack", ">= 1.0")
|
24
24
|
|
25
25
|
spec.add_dependency('samovar', "~> 1.3")
|
26
|
+
spec.add_dependency('localhost', "~> 1.1")
|
26
27
|
|
27
28
|
spec.add_development_dependency "async-rspec", "~> 1.7"
|
28
29
|
spec.add_development_dependency "async-websocket", "~> 0.6.0"
|
data/lib/falcon/command/serve.rb
CHANGED
@@ -19,11 +19,15 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
require_relative '../server'
|
22
|
+
require_relative '../endpoint'
|
23
|
+
|
24
|
+
require 'localhost/authority'
|
22
25
|
|
23
26
|
require 'async/container'
|
24
27
|
require 'async/io/trap'
|
25
28
|
require 'async/io/host_endpoint'
|
26
29
|
require 'async/io/shared_endpoint'
|
30
|
+
require 'async/io/ssl_endpoint'
|
27
31
|
|
28
32
|
require 'samovar'
|
29
33
|
|
@@ -36,11 +40,14 @@ module Falcon
|
|
36
40
|
self.description = "Run an HTTP server."
|
37
41
|
|
38
42
|
options do
|
43
|
+
option '-b/--bind <address>', "Bind to the given hostname/address", default: "https://localhost:9292"
|
44
|
+
|
45
|
+
option '-p/--port <number>', "Override the specified port", type: Integer
|
46
|
+
option '-h/--hostname <hostname>', "Specify the hostname which would be used for certificates, etc."
|
47
|
+
|
39
48
|
option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
|
40
49
|
option '-n/--concurrency <count>', "Number of processes to start", default: Async::Container.hardware_concurrency, type: Integer
|
41
50
|
|
42
|
-
option '-b/--bind <address>', "Bind to the given hostname/address", default: "tcp://localhost:9292"
|
43
|
-
|
44
51
|
option '--forked | --threaded', "Select a specific concurrency model", key: :container, default: :forked
|
45
52
|
end
|
46
53
|
|
@@ -64,13 +71,11 @@ module Falcon
|
|
64
71
|
def run(verbose)
|
65
72
|
app, options = load_app(verbose)
|
66
73
|
|
67
|
-
endpoint =
|
74
|
+
endpoint = Endpoint.parse(@options[:bind], reuse_port: true)
|
68
75
|
|
69
|
-
Async::Reactor.run do
|
70
|
-
|
71
|
-
|
72
|
-
)
|
73
|
-
end
|
76
|
+
bound_endpoint = Async::Reactor.run do
|
77
|
+
Async::IO::SharedEndpoint.bound(endpoint)
|
78
|
+
end.result
|
74
79
|
|
75
80
|
Async.logger.info "Falcon taking flight! Binding to #{endpoint} [#{container_class} with concurrency: #{@options[:concurrency]}]"
|
76
81
|
|
@@ -86,7 +91,7 @@ module Falcon
|
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
89
|
-
server = Falcon::Server.new(app, endpoint)
|
94
|
+
server = Falcon::Server.new(app, bound_endpoint, endpoint.protocol)
|
90
95
|
|
91
96
|
server.run
|
92
97
|
|
@@ -0,0 +1,55 @@
|
|
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/http/url_endpoint'
|
22
|
+
|
23
|
+
module Falcon
|
24
|
+
class Endpoint < Async::HTTP::URLEndpoint
|
25
|
+
def ssl_context
|
26
|
+
@options[:ssl_context] || build_ssl_context
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_endpoint(endpoint = nil)
|
30
|
+
super(@options.fetch(:bind, endpoint))
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_ssl_context(hostname = self.hostname)
|
34
|
+
authority = Localhost::Authority.fetch(hostname)
|
35
|
+
|
36
|
+
authority.server_context.tap do |context|
|
37
|
+
context.alpn_select_cb = lambda do |protocols|
|
38
|
+
if protocols.include? "h2"
|
39
|
+
return "h2"
|
40
|
+
elsif protocols.include? "http/1.1"
|
41
|
+
return "http/1.1"
|
42
|
+
elsif protocols.include? "http/1.0"
|
43
|
+
return "http/1.0"
|
44
|
+
else
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context.session_id_context = "falcon"
|
50
|
+
context.set_params
|
51
|
+
context.freeze
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/falcon/version.rb
CHANGED
data/logo.svg
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 600 220" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
|
4
|
+
<g id="Name" transform="matrix(1,0,-0.176327,1,245.058,11.0473)">
|
5
|
+
<g transform="matrix(12.4689,0,0,1,2662.53,0)">
|
6
|
+
<g opacity="0.5">
|
7
|
+
<g id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,97.1636)">
|
8
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
9
|
+
</g>
|
10
|
+
<g id="a2YeZXbxK1" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,107.164)">
|
11
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
12
|
+
</g>
|
13
|
+
<g id="a2YeZXbxK2" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,117.164)">
|
14
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
15
|
+
</g>
|
16
|
+
<g id="a2YeZXbxK3" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,127.164)">
|
17
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
18
|
+
</g>
|
19
|
+
<g id="a2YeZXbxK4" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,137.164)">
|
20
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
21
|
+
</g>
|
22
|
+
<g id="a2YeZXbxK5" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,147.164)">
|
23
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
24
|
+
</g>
|
25
|
+
<g id="a2YeZXbxK6" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,157.164)">
|
26
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
27
|
+
</g>
|
28
|
+
<g id="a2YeZXbxK7" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,167.164)">
|
29
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
30
|
+
</g>
|
31
|
+
<g id="a2YeZXbxK8" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,177.164)">
|
32
|
+
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
33
|
+
</g>
|
34
|
+
</g>
|
35
|
+
</g>
|
36
|
+
<g transform="matrix(1,0,0,1,-404.578,86.5424)">
|
37
|
+
<text x="207.138px" y="105.168px" style="font-family:'Phosphate-Inline', 'Phosphate';font-size:130px;">F<tspan x="258.228px 339.608px 393.038px 465.058px 561.258px " y="105.168px 105.168px 105.168px 105.168px 105.168px ">ALCON</tspan></text>
|
38
|
+
</g>
|
39
|
+
</g>
|
40
|
+
<g id="Logo" transform="matrix(1,0,0,1,709.001,7.14337)">
|
41
|
+
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
42
|
+
<path id="afwWrtpzn" d="M31.754,72.307L65.845,74.515L52.43,152.577L83.228,138.125L71.84,178.489L108.947,149.621L97.8,196.041L175.838,113.383L137.61,16.273L65.845,2.762L2.415,42.281L19.714,89.075L31.754,72.307Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
43
|
+
<path id="afwWrtpzn1" serif:id="afwWrtpzn" d="M31.754,72.307L65.845,74.515L52.43,152.577L83.228,138.125L71.84,178.489L108.947,149.621L97.8,196.041L175.838,113.383L137.61,16.273L65.845,2.762L2.415,42.281L19.714,89.075L31.754,72.307Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
44
|
+
</g>
|
45
|
+
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
46
|
+
<path id="f9Ro2kNLjt" d="M44.251,24.524L73.806,49.206L73.806,67.536L119.535,105.549L108.839,126.334L130.878,108.304L130.878,136.798L166.477,110.524L132.229,22.859L66.665,10.591L44.251,24.524Z" style="fill:rgb(102,102,102);fill-rule:nonzero;"/>
|
47
|
+
</g>
|
48
|
+
<g id="f9Ro2kNLjt1" serif:id="f9Ro2kNLjt" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
49
|
+
<path d="M107.112,106.033L73.806,75.082L67.438,113.958L107.112,106.033Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
50
|
+
</g>
|
51
|
+
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
52
|
+
<path id="a2YeZXbxK9" serif:id="a2YeZXbxK" d="M74.965,38.385L94.531,27.962L73.939,22.859L65.06,28.963L74.965,38.385Z" style="fill:rgb(243,242,182);fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
53
|
+
</g>
|
54
|
+
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
55
|
+
<path id="bck4zTqCc" d="M31.138,70.92L66.327,70.003L66.665,53.621L34.89,25.682L4.551,43.331L20.728,83.297L31.138,70.92Z" style="fill:url(#_Linear2);fill-rule:nonzero;"/>
|
56
|
+
<path id="bck4zTqCc1" serif:id="bck4zTqCc" d="M31.138,70.92L66.327,70.003L66.665,53.621L34.89,25.682L4.551,43.331L20.728,83.297L31.138,70.92Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
57
|
+
</g>
|
58
|
+
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
59
|
+
<g opacity="0.5">
|
60
|
+
<path id="c8tH4sZd3" d="M38.69,39.748L29.642,38.747L34.058,35.779L38.69,39.748Z" style="fill-rule:nonzero;"/>
|
61
|
+
<path id="c8tH4sZd31" serif:id="c8tH4sZd3" d="M38.69,39.748L29.642,38.747L34.058,35.779L38.69,39.748Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:1.21px;"/>
|
62
|
+
</g>
|
63
|
+
</g>
|
64
|
+
<g id="b4jPLXq2Q" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
65
|
+
<path d="M66.665,54.489L30.656,70.678" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
66
|
+
</g>
|
67
|
+
<g id="biuXOi8NB" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
68
|
+
<path d="M79.452,29.193L71.78,33.21L68.149,26.888L79.452,29.193Z" style="fill-rule:nonzero;"/>
|
69
|
+
</g>
|
70
|
+
<g id="biuXOi8NB1" serif:id="biuXOi8NB" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
71
|
+
<path d="M79.452,29.193L71.78,33.21L68.149,26.888L79.452,29.193Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:1.21px;"/>
|
72
|
+
</g>
|
73
|
+
<g id="aBf8t1uYg" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
74
|
+
<path d="M90.948,128.715L82.818,161.588L116.016,138.209L109.924,173.446L145.161,133.456L125.51,147.015L125.51,121.26L99.079,140.863L108.244,113.312L65.81,121.26L62.817,138.209L90.948,128.715Z" style="fill:url(#_Linear3);fill-rule:nonzero;"/>
|
75
|
+
</g>
|
76
|
+
</g>
|
77
|
+
<defs>
|
78
|
+
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.28147,40.3898,-40.3898,8.28147,75.559,73.5339)"><stop offset="0" style="stop-color:rgb(219,221,216);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(157,136,111);stop-opacity:1"/></linearGradient>
|
79
|
+
<linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-40.0703,32.5112,-32.5112,-40.0703,56.4664,35.6672)"><stop offset="0" style="stop-color:rgb(243,242,182);stop-opacity:1"/><stop offset="0.19" style="stop-color:rgb(178,177,142);stop-opacity:1"/><stop offset="0.4" style="stop-color:rgb(114,114,103);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(86,86,86);stop-opacity:1"/></linearGradient>
|
80
|
+
<linearGradient id="_Linear3" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(28.5157,44.2085,-44.2085,28.5157,93.954,114.461)"><stop offset="0" style="stop-color:rgb(159,139,114);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(138,105,90);stop-opacity:1"/></linearGradient>
|
81
|
+
</defs>
|
82
|
+
</svg>
|
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.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07
|
11
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.29.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.29.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-container
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: localhost
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: async-rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,12 +193,14 @@ files:
|
|
179
193
|
- lib/falcon/adapters/rewindable.rb
|
180
194
|
- lib/falcon/command.rb
|
181
195
|
- lib/falcon/command/serve.rb
|
196
|
+
- lib/falcon/endpoint.rb
|
182
197
|
- lib/falcon/hosts.rb
|
183
198
|
- lib/falcon/proxy.rb
|
184
199
|
- lib/falcon/server.rb
|
185
200
|
- lib/falcon/verbose.rb
|
186
201
|
- lib/falcon/version.rb
|
187
202
|
- lib/rack/handler/falcon.rb
|
203
|
+
- logo.svg
|
188
204
|
- server.rb
|
189
205
|
homepage: https://github.com/socketry/falcon
|
190
206
|
licenses: []
|