async-websocket 0.19.0 → 0.20.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: 0fd37d5eb2b762f6f5d7bb8027d3d51c1a9300f63d6d38b5bd7aec5a373d1a0d
4
- data.tar.gz: 0c8cf165cf58f920ac80534b08fef3146e08caa3676542bea72b6ae2b2fdbe9c
3
+ metadata.gz: 0a051f2295a5f0874fb78259a546cf65e99a7b507a781df04817d9472391506c
4
+ data.tar.gz: 7fdd299047a497220c5ef7640a287b6f52691982ff12175f8d93f9a258de814e
5
5
  SHA512:
6
- metadata.gz: e05aaeb2c9f4ce782bf99c57789d0e21d89a6fc262eae1141451c40c2d17776920117deae3f7c2864218a90ec5a5f7feb5ff4604460cb1cb5ee2ab783fac230d
7
- data.tar.gz: 919c2aa1bafd05fe0e2283d201553fd546f9e734f7f4134c9adfd62ea9fb6ac714eace090d487b22fd3613dcd52d64eed6a225143a56687f9cecddea973e84db
6
+ metadata.gz: 6fb7a9e49527d946cc762da5a45bb389c91debdc55598b959dd4543f1f31e5921d3fd3901d2b99d9d7d366b3cb7cb3efde014122cce4e6fb981a372a852a5db5
7
+ data.tar.gz: a6f33b3043a6453754f429ac494f4afb1e44f2e7bc6511ab3d42c65e55a3e59efcc5e8d99f807d68fe707a1f1b1084a2aaaade0393d3d7b6c7dad4396b866afd
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ n�z��KMR���*��6k9<���5��=E�8cG��Ħ/9�� ��c��:��U4يtw��� ��;��2��&1#F\���Nj��o��3`�ŝ!&n
2
+ ,�4�\�n�ADzw�D�-���Ǥ��Am�/��q�,δ~�����⍰����i�� ��'��Y��rޑ
@@ -30,11 +30,11 @@ module Async
30
30
  include ::Protocol::WebSocket::Headers
31
31
 
32
32
  def self.websocket?(request)
33
- Array(request.protocol).include?(PROTOCOL)
33
+ Array(request.protocol).any? { |e| e.casecmp?(PROTOCOL) }
34
34
  end
35
35
 
36
36
  def self.open(request, headers: [], protocols: [], handler: Connection, **options, &block)
37
- if Array(request.protocol).include?(PROTOCOL)
37
+ if websocket?(request)
38
38
  # Select websocket sub-protocol:
39
39
  if requested_protocol = request.headers[SEC_WEBSOCKET_PROTOCOL]
40
40
  protocol = (requested_protocol & protocols).first
@@ -21,6 +21,7 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require_relative 'http'
24
+ require 'protocol/rack/request'
24
25
 
25
26
  module Async
26
27
  module WebSocket
@@ -29,27 +30,19 @@ module Async
29
30
  include ::Protocol::WebSocket::Headers
30
31
 
31
32
  def self.websocket?(env)
32
- request = env['async.http.request'] and Array(request.protocol).include?(PROTOCOL)
33
+ HTTP.websocket?(
34
+ ::Protocol::Rack::Request[env]
35
+ )
33
36
  end
34
37
 
35
38
  def self.open(env, **options, &block)
36
- if request = env['async.http.request']
37
- env = nil
38
-
39
- if response = HTTP.open(request, **options, &block)
40
- headers = response.headers
41
-
42
- if protocol = response.protocol
43
- headers = Protocol::HTTP::Headers::Merged.new(headers, [
44
- ['rack.protocol', protocol]
45
- ])
46
- end
47
-
48
- return [response.status, headers.to_h, response.body]
49
- end
39
+ request = ::Protocol::Rack::Request[env]
40
+
41
+ if response = HTTP.open(request, **options, &block)
42
+ return Protocol::Rack::Adapter.make_response(env, response)
50
43
  end
51
44
  end
52
45
  end
53
46
  end
54
47
  end
55
- end
48
+ end
@@ -23,8 +23,7 @@
23
23
  require 'protocol/http/request'
24
24
  require 'protocol/http/headers'
25
25
  require 'protocol/websocket/headers'
26
-
27
- require 'async/http/body/stream'
26
+ require 'protocol/http/body/readable'
28
27
 
29
28
  module Async
30
29
  module WebSocket
@@ -66,7 +65,7 @@ module Async
66
65
  end
67
66
  end
68
67
 
69
- class Hijack < Async::HTTP::Body::Readable
68
+ class Hijack < Protocol::HTTP::Body::Readable
70
69
  def initialize(request)
71
70
  @request = request
72
71
  @stream = nil
@@ -35,7 +35,7 @@ module Async
35
35
  if protocol
36
36
  headers.add(SEC_WEBSOCKET_PROTOCOL, protocol)
37
37
  end
38
-
38
+
39
39
  body = Async::HTTP::Body::Hijack.wrap(request, &block)
40
40
  super(request.version, 200, headers, body)
41
41
  end
@@ -30,7 +30,7 @@ module Async
30
30
  def self.for(request, headers = nil, **options, &body)
31
31
  if request.version =~ /http\/1/i
32
32
  return UpgradeResponse.new(request, headers, **options, &body)
33
- elsif request.version =~ /h2/i
33
+ elsif request.version =~ /http\/2/i
34
34
  return ConnectResponse.new(request, headers, **options, &body)
35
35
  end
36
36
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module WebSocket
23
- VERSION = "0.19.0"
23
+ VERSION = "0.20.0"
24
24
  end
25
25
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - destructobeam
9
+ - Olle Jonsson
10
+ - Aurora
11
+ - Bryan Powell
12
+ - Gleb Sinyavskiy
13
+ - Janko Marohnić
14
+ - Michel Boaventura
15
+ - jaml
8
16
  autorequire:
9
17
  bindir: bin
10
- cert_chain: []
11
- date: 2021-06-05 00:00:00.000000000 Z
18
+ cert_chain:
19
+ - |
20
+ -----BEGIN CERTIFICATE-----
21
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
22
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
23
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
24
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
25
+ MBsGCgmSJomT8ixkARkWDW9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5lMon6tt9rNeXmnW/
41
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
42
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
43
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
44
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
45
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
46
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
47
+ -----END CERTIFICATE-----
48
+ date: 2022-08-19 00:00:00.000000000 Z
12
49
  dependencies:
13
50
  - !ruby/object:Gem::Dependency
14
51
  name: async-http
@@ -52,6 +89,20 @@ dependencies:
52
89
  - - "~>"
53
90
  - !ruby/object:Gem::Version
54
91
  version: 0.7.0
92
+ - !ruby/object:Gem::Dependency
93
+ name: protocol-rack
94
+ requirement: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: 0.1.1
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 0.1.1
55
106
  - !ruby/object:Gem::Dependency
56
107
  name: async-rspec
57
108
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
228
  - !ruby/object:Gem::Version
178
229
  version: '0'
179
230
  requirements: []
180
- rubygems_version: 3.3.0.dev
231
+ rubygems_version: 3.3.7
181
232
  signing_key:
182
233
  specification_version: 4
183
234
  summary: An async websocket library on top of websocket-driver.
metadata.gz.sig ADDED
Binary file