falcon 0.8.0 → 0.9.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/.travis.yml +3 -1
- data/README.md +0 -14
- data/examples/hello/config.ru +4 -0
- data/falcon.gemspec +3 -3
- data/lib/falcon/command.rb +1 -0
- data/lib/falcon/command/serve.rb +4 -9
- data/lib/falcon/server.rb +4 -2
- data/lib/falcon/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5998b68f454477fcb11ec2571d14eac6f231345175f8bebac905b951ba391dbd
|
4
|
+
data.tar.gz: b2c5eb9aa083eee62480aea639855a7eb5244f1485aab7b8cb65e936e69b132c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf9842920c7c80129a1f4660ae4a769530660c88696bc22464f8211b6d3cb0c358b9ea63f655f22d7c9676970400214ca8eb56efc65c97eeb967bb091264178e
|
7
|
+
data.tar.gz: 8645f34edab0d4365eb8092421a2a72b77416ca71546fdad28c7c278c3e7de99f0f1d0ff6c20dc84d1fcf7d9831a120db8e7b114a68cc4d7dad703a0b754a1b0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -50,20 +50,6 @@ You can invoke Falcon via `rackup`:
|
|
50
50
|
|
51
51
|
This will run a single-threaded instance of Falcon.
|
52
52
|
|
53
|
-
### Deploying with Passenger
|
54
|
-
|
55
|
-
You can run Falcon within Passenger to improve asyncronicity by using the `Falcon::Hijack` middleware. The first request from a client will be parsed by Passenger, but `rack.hijack` allows us to start parsing requests using Falcon within a separate `Async::Reactor` which reduces latency and avoids blocking IO where possible.
|
56
|
-
|
57
|
-
```ruby
|
58
|
-
|
59
|
-
if RACK_ENV == :production
|
60
|
-
use Falcon::Hijack
|
61
|
-
end
|
62
|
-
|
63
|
-
run MyApp
|
64
|
-
|
65
|
-
```
|
66
|
-
|
67
53
|
## Performance
|
68
54
|
|
69
55
|
Falcon is uses an asynchronous event-driven reactor to provide non-blocking IO. It can handle an arbitrary number of in-flight requests with minimal overhead per request.
|
data/falcon.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency("async-io", "~> 1.
|
20
|
-
spec.add_dependency("async-http", "~> 0.
|
21
|
-
spec.add_dependency("async-container", "~> 0.
|
19
|
+
spec.add_dependency("async-io", "~> 1.6")
|
20
|
+
spec.add_dependency("async-http", "~> 0.10")
|
21
|
+
spec.add_dependency("async-container", "~> 0.3")
|
22
22
|
|
23
23
|
spec.add_dependency("rack", ">= 1.0")
|
24
24
|
|
data/lib/falcon/command.rb
CHANGED
data/lib/falcon/command/serve.rb
CHANGED
@@ -25,25 +25,18 @@ require 'async/container'
|
|
25
25
|
require 'async/io/trap'
|
26
26
|
|
27
27
|
require 'samovar'
|
28
|
-
require 'etc'
|
29
28
|
|
30
29
|
require 'rack/builder'
|
31
30
|
require 'rack/server'
|
32
31
|
|
33
32
|
module Falcon
|
34
33
|
module Command
|
35
|
-
def self.default_concurrency
|
36
|
-
Etc.nprocessors
|
37
|
-
rescue
|
38
|
-
2
|
39
|
-
end
|
40
|
-
|
41
34
|
class Serve < Samovar::Command
|
42
35
|
self.description = "Run an HTTP server."
|
43
36
|
|
44
37
|
options do
|
45
38
|
option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
|
46
|
-
option '-n/--concurrency <count>', "Number of processes to start", default:
|
39
|
+
option '-n/--concurrency <count>', "Number of processes to start", default: Async::Container.hardware_concurrency, type: Integer
|
47
40
|
|
48
41
|
option '-b/--bind <address>', "Bind to the given hostname/address", default: "tcp://localhost:9292"
|
49
42
|
|
@@ -93,13 +86,15 @@ module Falcon
|
|
93
86
|
server = Falcon::Server.new(app, endpoint)
|
94
87
|
|
95
88
|
server.run
|
89
|
+
|
90
|
+
task.children.each(&:wait)
|
96
91
|
end
|
97
92
|
end
|
98
93
|
|
99
94
|
def invoke(parent)
|
100
95
|
container = run(parent.verbose?)
|
101
96
|
|
102
|
-
|
97
|
+
container.wait
|
103
98
|
end
|
104
99
|
end
|
105
100
|
end
|
data/lib/falcon/server.rb
CHANGED
@@ -34,11 +34,13 @@ module Falcon
|
|
34
34
|
|
35
35
|
def handle_request(request, peer, address)
|
36
36
|
request_path, query_string = request.path.split('?', 2)
|
37
|
-
server_name, server_port = request.
|
37
|
+
server_name, server_port = (request.authority || '').split(':', 2)
|
38
38
|
|
39
39
|
input = StringIO.new(request.body || '')
|
40
40
|
input.set_encoding(Encoding::BINARY)
|
41
41
|
|
42
|
+
headers = request.headers.to_http_hash
|
43
|
+
|
42
44
|
env = {
|
43
45
|
'rack.version' => [2, 0, 0],
|
44
46
|
|
@@ -68,7 +70,7 @@ module Falcon
|
|
68
70
|
# I'm not sure what sane defaults should be here:
|
69
71
|
'SERVER_NAME' => server_name || '',
|
70
72
|
'SERVER_PORT' => server_port || '',
|
71
|
-
}.merge(
|
73
|
+
}.merge(headers)
|
72
74
|
|
73
75
|
env['rack.hijack?'] = true
|
74
76
|
env['rack.hijack'] = lambda do
|
data/lib/falcon/version.rb
CHANGED
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.9.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-03-
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: async-http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.10'
|
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.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-container
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- README.md
|
152
152
|
- Rakefile
|
153
153
|
- bin/falcon
|
154
|
+
- examples/hello/config.ru
|
154
155
|
- examples/sinatra/Gemfile
|
155
156
|
- examples/sinatra/Gemfile.lock
|
156
157
|
- examples/sinatra/config.ru
|