falcon 0.8.0 → 0.9.0

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: f6fcbe05b21493aa8d6d96470a66afa9c4810e4bbc13f2580d89e5cac6cd3146
4
- data.tar.gz: be058b48b65e5c6310589bfc52a013ebc388f3caa8358a32a7323e676a01a789
3
+ metadata.gz: 5998b68f454477fcb11ec2571d14eac6f231345175f8bebac905b951ba391dbd
4
+ data.tar.gz: b2c5eb9aa083eee62480aea639855a7eb5244f1485aab7b8cb65e936e69b132c
5
5
  SHA512:
6
- metadata.gz: 3ba4fe3543c5cdd51100c64d38d2d6eee0ca26d9ecf37a9c5acb3da9b74ee7d5eee25dc09d9ed8023df66d2d23caed2756e3397ff763b2819d50297dd6d4e56b
7
- data.tar.gz: ff7f5dc43ce9cc3b81c48db67cf3c798c55ae4e52aa6643199dca56942a5224e76d7735a6ef6f11e24d1043ef72fb086b9ee9c199acb17cff36833a42a9e3f36
6
+ metadata.gz: cf9842920c7c80129a1f4660ae4a769530660c88696bc22464f8211b6d3cb0c358b9ea63f655f22d7c9676970400214ca8eb56efc65c97eeb967bb091264178e
7
+ data.tar.gz: 8645f34edab0d4365eb8092421a2a72b77416ca71546fdad28c7c278c3e7de99f0f1d0ff6c20dc84d1fcf7d9831a120db8e7b114a68cc4d7dad703a0b754a1b0
@@ -3,9 +3,11 @@ sudo: required
3
3
  dist: xenial
4
4
  cache: bundler
5
5
 
6
+ before_script:
7
+ - gem update --system
8
+
6
9
  matrix:
7
10
  include:
8
- - rvm: 2.2
9
11
  - rvm: 2.3
10
12
  - rvm: 2.4
11
13
  - rvm: 2.5
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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env falcon --verbose serve -c
2
+
3
+ run lambda {|env| [200, {}, ["Hello World"]]}
4
+
@@ -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.5")
20
- spec.add_dependency("async-http", "~> 0.8")
21
- spec.add_dependency("async-container", "~> 0.1")
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
 
@@ -19,6 +19,7 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  require_relative 'command/serve'
22
+
22
23
  require_relative 'version'
23
24
 
24
25
  require 'samovar'
@@ -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: Command.default_concurrency, type: Integer
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
- sleep
97
+ container.wait
103
98
  end
104
99
  end
105
100
  end
@@ -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.headers.fetch('HTTP_HOST', '').split(':', 2)
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(request.headers)
73
+ }.merge(headers)
72
74
 
73
75
  env['rack.hijack?'] = true
74
76
  env['rack.hijack'] = lambda do
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.8.0"
22
+ VERSION = "0.9.0"
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.8.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-26 00:00:00.000000000 Z
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.5'
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.5'
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.8'
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.8'
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.1'
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.1'
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