falcon 0.29.0 → 0.30.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1002d7af3d9b4c9cd36aabc15cfa55efaca63543c2422513b87f89dc4283edd
4
- data.tar.gz: 5180cb2d1cb93058cd8c0cdfbcc0fe986372df61ce25061ff2531631172a4855
3
+ metadata.gz: a93b677671ad9a275d8d63ec8caeb6f86bed3bfdad56768e558a20afde5326ed
4
+ data.tar.gz: 60023f6c2a5ad478e7199ff9c33550fb6e51a8dba6ebe200f513039f40ab0be6
5
5
  SHA512:
6
- metadata.gz: dc747f7df864008cc156bd54afa992166ca598337a15cf8eca18e290a6223ef90e0b7e0f2e80b6d18adcdbb32d1447e3912a8284f4aaa6905f197096ec85754a
7
- data.tar.gz: 8f9de5fb3a53972649b4caa1c25e1937d5e6a429d9a932d62b8f5b40e7b933ba55e41077da81b6c5305e43e3774c7b7c4f9ca7f3e5d53105c7fa6b9cb723c7dc
6
+ metadata.gz: bce2c09729a60ab971401426265b9d64652343a45f322d7990ce2c9d966046f71693ecf34044c857ef627856f94b078848072259a99fdc74fbbfea6eecfd2595
7
+ data.tar.gz: '0449e4726e6fc098aeb44228c32b21c371fd40a97181bc36a0532cba1833555a6f2475fa0e54ae349251b8a1effba209b3d1747f71bbc2837f2b23bd395257da'
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "async", "~> 1.13"
23
23
  spec.add_dependency "async-io", "~> 1.22"
24
- spec.add_dependency "async-http", "~> 0.39.0"
24
+ spec.add_dependency "async-http", "~> 0.40.0"
25
25
  spec.add_dependency "async-container", "~> 0.10.0"
26
26
 
27
27
  spec.add_dependency "rack", ">= 1.0"
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_development_dependency "trenni"
34
34
  spec.add_development_dependency "async-rspec", "~> 1.7"
35
- spec.add_development_dependency "async-websocket", "~> 0.6.0"
35
+ spec.add_development_dependency "async-websocket", "~> 0.9.0"
36
36
  spec.add_development_dependency "async-process", "~> 1.1"
37
37
 
38
38
  spec.add_development_dependency "covered", "~> 0.10"
@@ -23,7 +23,6 @@ require 'rack'
23
23
  require_relative 'input'
24
24
  require_relative 'response'
25
25
  require_relative 'early_hints'
26
- require_relative 'hijack'
27
26
 
28
27
  require 'async/logger'
29
28
 
@@ -185,7 +184,7 @@ module Falcon
185
184
  if full_hijack
186
185
  return nil
187
186
  else
188
- return Response.wrap(status, headers, body, request, env)
187
+ return Response.wrap(status, headers, body, request)
189
188
  end
190
189
  rescue => exception
191
190
  @logger.error(self) {exception}
@@ -19,10 +19,10 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  require_relative 'output'
22
- require_relative 'hijack'
23
22
  require_relative '../version'
24
23
  require_relative '../proxy'
25
24
 
25
+ require 'async/http/body/hijack'
26
26
  require 'time'
27
27
 
28
28
  module Falcon
@@ -50,16 +50,16 @@ module Falcon
50
50
  return headers, meta
51
51
  end
52
52
 
53
- def self.wrap(status, headers, body, request = nil, env = nil)
53
+ def self.wrap(status, headers, body, request = nil)
54
54
  headers, meta = wrap_headers(headers)
55
55
 
56
- if block = meta['rack.hijack'] and request and env
57
- body = Hijack.for(env, block, request.hijack? ? request.hijack! : nil)
56
+ if block = meta['rack.hijack']
57
+ body = Async::HTTP::Body::Hijack.wrap(request, &block)
58
58
  else
59
- sliced = headers.slice!(IGNORE_HEADERS)
59
+ ignored = headers.extract(IGNORE_HEADERS)
60
60
 
61
- unless sliced.empty?
62
- Async.logger.warn("Ignoring protocol-level headers: #{sliced.inspect}")
61
+ unless ignored.empty?
62
+ Async.logger.warn("Ignoring protocol-level headers: #{ignored.inspect}")
63
63
  end
64
64
 
65
65
  body = Output.wrap(status, headers, body)
@@ -80,10 +80,10 @@ module Falcon
80
80
 
81
81
  def prepare_headers(headers)
82
82
  if connection = headers[CONNECTION]
83
- headers.slice!(connection)
83
+ headers.extract(connection)
84
84
  end
85
85
 
86
- headers.slice!(HOP_HEADERS)
86
+ headers.extract(HOP_HEADERS)
87
87
  end
88
88
 
89
89
  def prepare_request(request, host)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.29.0"
22
+ VERSION = "0.30.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.29.0
4
+ version: 0.30.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: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.39.0
47
+ version: 0.40.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.39.0
54
+ version: 0.40.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: async-container
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.6.0
159
+ version: 0.9.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.6.0
166
+ version: 0.9.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: async-process
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -268,7 +268,6 @@ files:
268
268
  - gems/rack3.gemfile
269
269
  - lib/falcon.rb
270
270
  - lib/falcon/adapters/early_hints.rb
271
- - lib/falcon/adapters/hijack.rb
272
271
  - lib/falcon/adapters/input.rb
273
272
  - lib/falcon/adapters/output.rb
274
273
  - lib/falcon/adapters/rack.rb
@@ -1,84 +0,0 @@
1
- # Copyright, 2019, 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/middleware'
22
- require 'async/io/buffer'
23
-
24
- module Falcon
25
- module Adapters
26
- # This is used for implementing partial hijack.
27
- class Hijack
28
- def self.for(env, block, socket = nil, task: Async::Task.current)
29
- input = socket || env[Rack::RACK_INPUT]
30
- output = Async::HTTP::Body::Writable.new
31
-
32
- stream = Hijack.new(input, output)
33
-
34
- task.async do
35
- begin
36
- block.call(stream)
37
- ensure
38
- output.close
39
- end
40
- end
41
-
42
- return output
43
- end
44
-
45
- def initialize(input, output)
46
- @input = input
47
- @output = output
48
- end
49
-
50
- def read(length = nil, buffer = nil)
51
- @input.read(length, buffer)
52
- end
53
-
54
- def read_nonblock(length, buffer = nil)
55
- @input.read(length, buffer)
56
- end
57
-
58
- def write(buffer)
59
- @output.write(buffer)
60
- end
61
-
62
- alias write_nonblock write
63
-
64
- def flush
65
- end
66
-
67
- def close
68
- @output.close
69
- end
70
-
71
- def close_read
72
- if @input.respond_to?(:close_read)
73
- @input.close_read
74
- else
75
- @input.close
76
- end
77
- end
78
-
79
- def close_write
80
- @output.close
81
- end
82
- end
83
- end
84
- end