falcon 0.40.1 → 0.41.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: 94f85c9e2ed95f6a43fda46cc07a986436ec7d874294b28288bcb004d269ea3c
4
- data.tar.gz: f56850aab821d12cd73cdc1545ad2691bce81d1121ae543feb3d29f6e8ae28da
3
+ metadata.gz: 9ea41a48b0da7b6ba65df7bd8f3c63c06a8deb498119079f8ca03367bc78cfa5
4
+ data.tar.gz: 79e5693fc78e56b829d88b6addffe4d255fa09629cf201356192eb70563e1036
5
5
  SHA512:
6
- metadata.gz: 047ac6d846d54362c8cc220f0264c60f9c951c557a61ca9c34636a93198acf04ab1b6e0b7ff10a684a8700f4b6a158dd57abf453cfa71bd5e9dee949eeedccdf
7
- data.tar.gz: 425b8131c9cbbe18684492213351e480a42d8037fc198c234ce7cd19e5f3f61b5bf59145b8335e8508928ee766ddcbff8992925084c2f5dbd5cfe1f0207de03b
6
+ metadata.gz: d97ae8f6aebe79fa10c410ca4ba038a731b6ace354b2bcc2bd8ec0d5a958fefed7c89d5bd47141fbb0e2f8fbbac869476e6bc1c552a8034ddc9b5835e9278d4c
7
+ data.tar.gz: '080b0ac4a57575b3177024248fa538d7019f3812eed267a3fd5ca9b7de7cc9388759d55c51a6b0de6b2aa71788b69f2bbc08e08488415f3cfc7e54d3707f8a14'
checksums.yaml.gz.sig CHANGED
Binary file
@@ -35,19 +35,37 @@ module Falcon
35
35
  # @parameter status [Integer] The response status.
36
36
  # @parameter headers [Protocol::HTTP::Headers] The response headers.
37
37
  # @parameter body [Object] The `rack` response body.
38
- def self.wrap(status, headers, body)
38
+ def self.wrap(status, headers, body, request = nil)
39
39
  # In no circumstance do we want this header propagating out:
40
40
  if length = headers.delete(CONTENT_LENGTH)
41
41
  # We don't really trust the user to provide the right length to the transport.
42
42
  length = Integer(length)
43
43
  end
44
44
 
45
+ # If we have an Async::HTTP body, we return it directly:
45
46
  if body.is_a?(::Protocol::HTTP::Body::Readable)
47
+ # warn "Returning #{body.class} as body is falcon-specific and may be removed in the future!"
46
48
  return body
47
- elsif status == 200 and body.respond_to?(:to_path)
48
- # Don't mangle partial responsese (206)
49
- return ::Protocol::HTTP::Body::File.open(body.to_path)
50
- elsif body.is_a?(Array)
49
+ end
50
+
51
+ # Otherwise, we have a more typical response body:
52
+ if status == 200 and body.respond_to?(:to_path)
53
+ begin
54
+ # Don't mangle partial responses (206)
55
+ return ::Protocol::HTTP::Body::File.open(body.to_path).tap do
56
+ body.close if body.respond_to?(:close) # Close the original body.
57
+ end
58
+ rescue Errno::ENOENT
59
+ # If the file is not available, ignore.
60
+ end
61
+ end
62
+
63
+ # If we have a streaming body, we hijack the connection:
64
+ unless body.respond_to?(:each)
65
+ return Async::HTTP::Body::Hijack.new(body, request&.body)
66
+ end
67
+
68
+ if body.is_a?(Array)
51
69
  length ||= body.sum(&:bytesize)
52
70
  return self.new(body, length)
53
71
  else
@@ -81,7 +81,7 @@ module Falcon
81
81
  Console.logger.warn("Ignoring protocol-level headers: #{ignored.inspect}")
82
82
  end
83
83
 
84
- body = Output.wrap(status, headers, body)
84
+ body = Output.wrap(status, headers, body, request)
85
85
  end
86
86
 
87
87
  if request&.head?
@@ -20,7 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require_relative '../extensions/openssl'
24
23
  require_relative '../controller/proxy'
25
24
  require_relative '../tls'
26
25
 
@@ -46,7 +45,7 @@ environment(:tls) do
46
45
  # The list of certificates loaded from that path.
47
46
  # @attribute [Array(OpenSSL::X509::Certificate)]
48
47
  ssl_certificates do
49
- OpenSSL::X509.load_certificates(ssl_certificate_path)
48
+ OpenSSL::X509::Certificate.load_file(ssl_certificate_path)
50
49
  end
51
50
 
52
51
  # The main certificate.
data/lib/falcon/tls.rb CHANGED
@@ -20,8 +20,6 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require_relative 'extensions/openssl'
24
-
25
23
  module Falcon
26
24
  module TLS
27
25
  # The list of supported ciphers.
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Falcon
24
- VERSION = "0.40.1"
24
+ VERSION = "0.41.0"
25
25
  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.1
4
+ version: 0.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -27,33 +27,34 @@ bindir: bin
27
27
  cert_chain:
28
28
  - |
29
29
  -----BEGIN CERTIFICATE-----
30
- MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
31
- ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
32
- MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
33
- aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
34
- AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
35
- xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
36
- eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
37
- L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
38
- 9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
39
- E/mljo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s
46
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
47
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
48
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
49
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
50
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
51
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
52
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
53
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
54
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
55
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
55
56
  -----END CERTIFICATE-----
56
- date: 2022-07-19 00:00:00.000000000 Z
57
+ date: 2022-08-07 00:00:00.000000000 Z
57
58
  dependencies:
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: async
@@ -89,14 +90,14 @@ dependencies:
89
90
  requirements:
90
91
  - - "~>"
91
92
  - !ruby/object:Gem::Version
92
- version: 0.56.0
93
+ version: 0.57.0
93
94
  type: :runtime
94
95
  prerelease: false
95
96
  version_requirements: !ruby/object:Gem::Requirement
96
97
  requirements:
97
98
  - - "~>"
98
99
  - !ruby/object:Gem::Version
99
- version: 0.56.0
100
+ version: 0.57.0
100
101
  - !ruby/object:Gem::Dependency
101
102
  name: async-http-cache
102
103
  requirement: !ruby/object:Gem::Requirement
@@ -167,6 +168,20 @@ dependencies:
167
168
  - - "~>"
168
169
  - !ruby/object:Gem::Version
169
170
  version: '1.1'
171
+ - !ruby/object:Gem::Dependency
172
+ name: openssl
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - "~>"
176
+ - !ruby/object:Gem::Version
177
+ version: '3.0'
178
+ type: :runtime
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - "~>"
183
+ - !ruby/object:Gem::Version
184
+ version: '3.0'
170
185
  - !ruby/object:Gem::Dependency
171
186
  name: process-metrics
172
187
  requirement: !ruby/object:Gem::Requirement
@@ -243,14 +258,14 @@ dependencies:
243
258
  requirements:
244
259
  - - "~>"
245
260
  - !ruby/object:Gem::Version
246
- version: 0.14.0
261
+ version: 0.19.2
247
262
  type: :development
248
263
  prerelease: false
249
264
  version_requirements: !ruby/object:Gem::Requirement
250
265
  requirements:
251
266
  - - "~>"
252
267
  - !ruby/object:Gem::Version
253
- version: 0.14.0
268
+ version: 0.19.2
254
269
  - !ruby/object:Gem::Dependency
255
270
  name: bake
256
271
  requirement: !ruby/object:Gem::Requirement
@@ -334,7 +349,6 @@ files:
334
349
  - lib/falcon/environments/self_signed_tls.rb
335
350
  - lib/falcon/environments/supervisor.rb
336
351
  - lib/falcon/environments/tls.rb
337
- - lib/falcon/extensions/openssl.rb
338
352
  - lib/falcon/middleware/proxy.rb
339
353
  - lib/falcon/middleware/redirect.rb
340
354
  - lib/falcon/middleware/verbose.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright, 2018, 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 'openssl/x509'
24
-
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
34
- end
35
- end
36
- end