async-websocket 0.19.2 → 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: 4494a49f3ddda2ac524f29eb3d7c9819441f8816532f4e2650f4a375580cac5a
4
- data.tar.gz: 93d249315220fc12d1619ed02e0706ce5c24f6591fb820c6f8894e6f8009e877
3
+ metadata.gz: 0a051f2295a5f0874fb78259a546cf65e99a7b507a781df04817d9472391506c
4
+ data.tar.gz: 7fdd299047a497220c5ef7640a287b6f52691982ff12175f8d93f9a258de814e
5
5
  SHA512:
6
- metadata.gz: 3c66caf1da58fb21136cdbdbd9c7d4342b270b65d524578eaa8821f15877f081324fd7c74aa22c16d7a062ea4e7a926c8baa6ab8bdcb111f45a4bd111d999f29
7
- data.tar.gz: 1ee636003a5962dea1ed85465bb2cd4447b3589d51cca1b11df6f473f7a54ae348bc0a94ded3aab66bb9ba6a78083157ce29ca6a08ce3b39c345d28573f7ae75
6
+ metadata.gz: 6fb7a9e49527d946cc762da5a45bb389c91debdc55598b959dd4543f1f31e5921d3fd3901d2b99d9d7d366b3cb7cb3efde014122cce4e6fb981a372a852a5db5
7
+ data.tar.gz: a6f33b3043a6453754f429ac494f4afb1e44f2e7bc6511ab3d42c65e55a3e59efcc5e8d99f807d68fe707a1f1b1084a2aaaade0393d3d7b6c7dad4396b866afd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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,6 +23,7 @@
23
23
  require 'protocol/http/request'
24
24
  require 'protocol/http/headers'
25
25
  require 'protocol/websocket/headers'
26
+ require 'protocol/http/body/readable'
26
27
 
27
28
  module Async
28
29
  module WebSocket
@@ -64,7 +65,7 @@ module Async
64
65
  end
65
66
  end
66
67
 
67
- class Hijack < Async::HTTP::Body::Readable
68
+ class Hijack < Protocol::HTTP::Body::Readable
68
69
  def initialize(request)
69
70
  @request = request
70
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.2"
23
+ VERSION = "0.20.0"
24
24
  end
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: async-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -45,7 +45,7 @@ cert_chain:
45
45
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
46
46
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
47
47
  -----END CERTIFICATE-----
48
- date: 2022-08-07 00:00:00.000000000 Z
48
+ date: 2022-08-19 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: async-http
@@ -89,6 +89,20 @@ dependencies:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
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
92
106
  - !ruby/object:Gem::Dependency
93
107
  name: async-rspec
94
108
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file