falcon 0.36.6 → 0.37.3

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: 6300b3661cb95b9f40b96380bcaf3a54044aade0eb8724b731189b0b95107269
4
- data.tar.gz: de4feb2c8182fb7024b17b2751d9f714b9fc77dd9f7854396ffd40ca648f8abe
3
+ metadata.gz: b240901ff29dc4a68d18830f1e3dbb84a5bfed4dbab35c74969d370104a3d1f4
4
+ data.tar.gz: 1e774e50cb244342921656a156f06fe7d5b349efa9ea711559a9e11dad093aba
5
5
  SHA512:
6
- metadata.gz: 6293dd69ca2c6d87752027af2145b225e4ce17e5e86d8c4dab81478dad4b301d75d9f3ffd14245c1123fab944e7e46a0eb83757b761022187f0746e94663d340
7
- data.tar.gz: f10f396da26dd4108623da29dbf7673887bf2b74c2c708c58de05a5dbcda0df61b5e0fabd24ba2e0a5acaff2fb65d0fd666fa8806b847049cb5a1078768ec1d3
6
+ metadata.gz: e23e5230a0d823575cf87218e1072fdf46e44db1cb969f272686aed98ca588558fdc3726c9c3c950ebc33345d026e1bae192e46bad97a3ece63eadf40766d089
7
+ data.tar.gz: '010872a133c0dd5169eabb0cbbf2f185b2941f0fccd4831ef659f2ec1e2315d0f06e881394ba0de5684b9c9cd40ba548758cff7307661fc5b5fe53ed8f522b41'
@@ -24,7 +24,6 @@ require 'rack'
24
24
 
25
25
  require_relative 'input'
26
26
  require_relative 'response'
27
- require_relative 'early_hints'
28
27
 
29
28
  require 'async/logger'
30
29
 
@@ -60,7 +59,6 @@ module Falcon
60
59
  RACK_HIJACK = 'rack.hijack'
61
60
  RACK_IS_HIJACK = 'rack.hijack?'
62
61
  RACK_HIJACK_IO = 'rack.hijack_io'
63
- RACK_EARLY_HINTS = "rack.early_hints"
64
62
 
65
63
  # Async::HTTP specific metadata:
66
64
 
@@ -184,10 +182,6 @@ module Falcon
184
182
 
185
183
  self.unwrap_request(request, env)
186
184
 
187
- if request.push?
188
- env[RACK_EARLY_HINTS] = EarlyHints.new(request)
189
- end
190
-
191
185
  full_hijack = false
192
186
 
193
187
  if request.hijack?
@@ -92,10 +92,10 @@ module Falcon
92
92
  protocol = meta['rack.protocol']
93
93
 
94
94
  # https://tools.ietf.org/html/rfc7231#section-7.4.2
95
- headers.add('server', "falcon/#{Falcon::VERSION}")
95
+ # headers.add('server', "falcon/#{Falcon::VERSION}")
96
96
 
97
97
  # https://tools.ietf.org/html/rfc7231#section-7.1.1.2
98
- headers.add('date', Time.now.httpdate)
98
+ # headers.add('date', Time.now.httpdate)
99
99
 
100
100
  return self.new(status, headers, body, protocol)
101
101
  end
@@ -71,7 +71,15 @@ module Falcon
71
71
  buffer.puts "- To reload: kill -HUP #{Process.pid}"
72
72
  end
73
73
 
74
- Bundler.require(:preload)
74
+ begin
75
+ Bundler.require(:preload)
76
+ rescue Bundler::GemfileNotFound
77
+ # Ignore.
78
+ end
79
+
80
+ if GC.respond_to?(:compact)
81
+ GC.compact
82
+ end
75
83
 
76
84
  self.controller.run
77
85
  end
@@ -145,7 +145,11 @@ module Falcon
145
145
  load(full_path)
146
146
  end
147
147
 
148
- Bundler.require(:preload)
148
+ begin
149
+ Bundler.require(:preload)
150
+ rescue Bundler::GemfileNotFound
151
+ # Ignore.
152
+ end
149
153
 
150
154
  if GC.respond_to?(:compact)
151
155
  GC.compact
@@ -77,6 +77,8 @@ module Falcon
77
77
  buffer.puts "- To reload all sites: kill -HUP #{Process.pid}"
78
78
  end
79
79
 
80
+ ENV['CONSOLE_LEVEL'] = 'debug'
81
+
80
82
  self.controller.run
81
83
  end
82
84
 
@@ -112,6 +112,10 @@ module Falcon
112
112
  if service.is_a?(Service::Proxy)
113
113
  Async.logger.info(self) {"Proxying #{service.authority} to #{service.endpoint}"}
114
114
  @hosts[service.authority] = service
115
+
116
+ # Pre-cache the ssl contexts:
117
+ # It seems some OpenSSL objects don't like event-driven I/O.
118
+ service.ssl_context
115
119
  end
116
120
  end
117
121
 
@@ -68,6 +68,8 @@ module Falcon
68
68
  Async::IO::SharedEndpoint.bound(@endpoint)
69
69
  end.wait
70
70
 
71
+ Async.logger.info(self) { "Starting #{name} on #{@endpoint.to_url}" }
72
+
71
73
  @debug_trap.ignore!
72
74
 
73
75
  super
@@ -100,7 +102,7 @@ module Falcon
100
102
  end
101
103
  end
102
104
 
103
- server = Falcon::Server.new(app, @bound_endpoint, @endpoint.protocol, @endpoint.scheme)
105
+ server = Falcon::Server.new(app, @bound_endpoint, protocol: @endpoint.protocol, scheme: @endpoint.scheme)
104
106
 
105
107
  server.run
106
108
 
@@ -90,7 +90,7 @@ module Falcon
90
90
  Async(logger: logger) do |task|
91
91
  Async.logger.info(self) {"Starting application server for #{self.root}..."}
92
92
 
93
- server = Server.new(self.middleware, @bound_endpoint, protocol, scheme)
93
+ server = Server.new(self.middleware, @bound_endpoint, protocol: protocol, scheme: scheme)
94
94
 
95
95
  server.run
96
96
 
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Falcon
24
- VERSION = "0.36.6"
24
+ VERSION = "0.37.3"
25
25
  end
@@ -32,7 +32,7 @@ module Rack
32
32
  app = ::Falcon::Adapters::Rack.new(app)
33
33
  app = ::Falcon::Adapters::Rewindable.new(app)
34
34
 
35
- server = ::Falcon::Server.new(app, endpoint, Async::HTTP::Protocol::HTTP1, SCHEME)
35
+ server = ::Falcon::Server.new(app, endpoint, protocol: Async::HTTP::Protocol::HTTP1, scheme: SCHEME)
36
36
  yield server if block_given?
37
37
 
38
38
  Async::Reactor.run do
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.36.6
4
+ version: 0.37.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-19 00:00:00.000000000 Z
11
+ date: 2021-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.52.0
47
+ version: 0.54.0
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.52.0
54
+ version: 0.54.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: async-http-cache
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.0
61
+ version: 0.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.0
68
+ version: 0.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: async-io
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -260,7 +260,6 @@ files:
260
260
  - bin/falcon
261
261
  - bin/falcon-host
262
262
  - lib/falcon.rb
263
- - lib/falcon/adapters/early_hints.rb
264
263
  - lib/falcon/adapters/input.rb
265
264
  - lib/falcon/adapters/output.rb
266
265
  - lib/falcon/adapters/rack.rb
@@ -323,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
322
  - !ruby/object:Gem::Version
324
323
  version: '0'
325
324
  requirements: []
326
- rubygems_version: 3.0.3
325
+ rubygems_version: 3.2.3
327
326
  signing_key:
328
327
  specification_version: 4
329
328
  summary: A fast, asynchronous, rack-compatible web server.
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'protocol/http/middleware'
24
-
25
- module Falcon
26
- module Adapters
27
- # Provide an interface for advising the client to preload related resources.
28
- class EarlyHints
29
- PRELOAD = /<(?<path>.*?)>;.*?rel=preload/
30
-
31
- # Initialize the early hints interface.
32
- #
33
- # @parameter request [Protocol::HTTP::Request]
34
- def initialize(request)
35
- @request = request
36
- end
37
-
38
- # Advise the request that the specified path should be preloaded.
39
- # @parameter path [String]
40
- # @parameter preload [Boolean] whether the client should preload the resource.
41
- def push(path, preload: true, **options)
42
- @request.push(path)
43
- end
44
-
45
- # Extract link headers and invoke {push}.
46
- def call(headers)
47
- headers.each do |key, value|
48
- if key.casecmp("link").zero? and match = PRELOAD.match(value)
49
- @request.push(match[:path])
50
- else
51
- Async.logger.warn(@request) {"Unsure how to handle early hints header: #{key}"}
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end