async-websocket 0.27.0 → 0.29.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: 7deca426ef06ec0886b25c2786697db4b9b3c98b2424eead9f227dd53879e3b5
4
- data.tar.gz: d21453d57e1a10e04b41c192e39a050274ef80f44eb78aaea69d48c662146bd9
3
+ metadata.gz: 4289b4859913198c24ca663a119281dd61bb34549e6cfe3cc9b85fe27e31c6ab
4
+ data.tar.gz: 651f3364c06bd402877b94a36f2d358ab3cc1167a0aa9dd2c44b3745be04cfe5
5
5
  SHA512:
6
- metadata.gz: 1400f27ba9a845dc4867c2d16461759d4e6036ba711f08c9e198393bb76e7c5363b3de6a36d437405c31cc88b1f712f077b181c0ddebe1acf9e314dbc7649f4d
7
- data.tar.gz: d022004d81f93c2c75b36c0331ecccd4e9c0b51214378dd9d8ddd07fbe9069da23edaa3d957bef0d2b357f94b26fff20446b110f6efb24470ca735d6fb49b05b
6
+ metadata.gz: ec78385e62fe64eae8e50e7f8cd70f7f1a317c3a9961d72ac0f33f1682d99fc6bb753ce91611bceaa9cb642edd978dcb6d59ca4dbea978c1b0d9804a934dddb6
7
+ data.tar.gz: da98480c126237140e19e45983ce73cb47e949c29078a5d867f694e02eab180e7f707649a0a4f6ad8e6377ea6412faddca63822866e73027995695aaecb12a90
checksums.yaml.gz.sig CHANGED
Binary file
@@ -110,9 +110,7 @@ module Async
110
110
  response = request.call(connection)
111
111
 
112
112
  unless response.stream?
113
- response.close
114
-
115
- raise ProtocolError, "Failed to negotiate connection: #{response.status}"
113
+ raise ConnectionError.new("Failed to negotiate connection!", response.unwrap)
116
114
  end
117
115
 
118
116
  protocol = response.headers[SEC_WEBSOCKET_PROTOCOL]&.first
@@ -28,6 +28,10 @@ module Async
28
28
  @response.close
29
29
  end
30
30
 
31
+ def unwrap
32
+ @response.buffered!
33
+ end
34
+
31
35
  attr_accessor :response
32
36
  attr_accessor :stream
33
37
 
@@ -19,6 +19,11 @@ module Async
19
19
  headers.add(SEC_WEBSOCKET_PROTOCOL, protocol)
20
20
  end
21
21
 
22
+ # For compatibility with HTTP/1 websockets proxied over HTTP/2, we process the accept nounce here:
23
+ if accept_nounce = request.headers[SEC_WEBSOCKET_KEY]&.first
24
+ headers.add(SEC_WEBSOCKET_ACCEPT, Nounce.accept_digest(accept_nounce))
25
+ end
26
+
22
27
  body = Async::HTTP::Body::Hijack.wrap(request, &block)
23
28
 
24
29
  super(request.version, 200, headers, body)
@@ -15,5 +15,16 @@ module Async
15
15
 
16
16
  class UnsupportedVersionError < Error
17
17
  end
18
+
19
+ class ConnectionError < Error
20
+ def initialize(message, response)
21
+ super(message)
22
+
23
+ @response = response
24
+ end
25
+
26
+ # The failed HTTP response.
27
+ attr :response
28
+ end
18
29
  end
19
30
  end
@@ -33,6 +33,10 @@ module Async
33
33
  @response.close
34
34
  end
35
35
 
36
+ def unwrap
37
+ @response.buffered!
38
+ end
39
+
36
40
  attr_accessor :response
37
41
 
38
42
  def stream?
@@ -77,6 +81,7 @@ module Async
77
81
  raise ProtocolError, "Invalid accept digest, expected #{expected_accept_digest.inspect}, got #{accept_digest.inspect}!"
78
82
  end
79
83
  end
84
+
80
85
  verified = accept_digest && Array(response.protocol).map(&:downcase) == %w(websocket) && response.headers['connection']&.include?('upgrade')
81
86
 
82
87
  return Wrapper.new(response, verified: verified)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module WebSocket
8
- VERSION = "0.27.0"
8
+ VERSION = "0.29.0"
9
9
  end
10
10
  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.27.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -49,7 +49,7 @@ cert_chain:
49
49
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
50
50
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
51
51
  -----END CERTIFICATE-----
52
- date: 2024-07-03 00:00:00.000000000 Z
52
+ date: 2024-09-03 00:00:00.000000000 Z
53
53
  dependencies:
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: async-http
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0.54'
68
+ - !ruby/object:Gem::Dependency
69
+ name: protocol-http
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.28.1
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.28.1
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: protocol-rack
70
84
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file