async-websocket 0.25.0 → 0.26.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: c1a77ed478fbb3aee00fd80f936d9ed2c35b681c3b259c0ffea5b5727d73ad94
4
- data.tar.gz: 7ba595dab5862934d8406815030091e9d564c2fb0bd400ad62942392a7e7cc63
3
+ metadata.gz: ee54a400cc9103d9fb64852edc368fed4c0f288d5e78b72656375a3dfb4c28ed
4
+ data.tar.gz: f58fdc2b051e0ae052b6b4ee1e68b0f31c70fc720d30733365669f719a178adc
5
5
  SHA512:
6
- metadata.gz: 92ed6719f6e5f5d0e9a602cd5480115da5e5e3dc2c2fb7477448c713fae5fa049797c93f1ba59bfc46f45273b23467509b996ca17ac16994f2c0488553e563ce
7
- data.tar.gz: dee7c21aebc62a27823a8cf78959d2bbaa891c96c3b864aed260c2f21ee050695496b5597717149216fc2fc674c91bc9191ae789d9bc0d188262897acec4e524
6
+ metadata.gz: b9a06b567caeb24653854e41f0a483ea8fd0408da607bea334a558d2d508f7b13e60563e5dfb987978b8ce18797af01470c807e91887e621c5a5bb2a653b8dd0
7
+ data.tar.gz: '033085a398cfa0cf26fd972bcb035a46a07385a9d34949f07339357afe66620629d33082038f56930909dd3462627763512fc79a9120e3236fb7bda9aba190e7'
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
+ # Copyright, 2023, by Emily Love Mills.
5
6
 
6
7
  require_relative 'rack'
7
8
 
@@ -13,7 +14,7 @@ module Async
13
14
  if response = Rack.open(request.env, **options, &block)
14
15
  ::Rack::Response[*response]
15
16
  else
16
- ::ActionDispatch::Response.new(404, [], [])
17
+ ::ActionDispatch::Response.new(404)
17
18
  end
18
19
  end
19
20
  end
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2015-2023, by Samuel Williams.
5
5
  # Copyright, 2019, by Bryan Powell.
6
6
  # Copyright, 2019, by Janko Marohnić.
7
+ # Copyright, 2023, by Thomas Morgan.
7
8
 
8
9
  require_relative 'request'
9
10
  require_relative 'connection'
@@ -90,14 +91,14 @@ module Async
90
91
  end
91
92
  end
92
93
 
93
- def connect(authority, path, headers: nil, handler: Connection, extensions: ::Protocol::WebSocket::Extensions::Client.default, **options, &block)
94
+ def connect(authority, path, scheme: @delegate.scheme, headers: nil, handler: Connection, extensions: ::Protocol::WebSocket::Extensions::Client.default, **options, &block)
94
95
  headers = ::Protocol::HTTP::Headers[headers]
95
96
 
96
97
  extensions&.offer do |extension|
97
98
  headers.add(SEC_WEBSOCKET_EXTENSIONS, extension.join("; "))
98
99
  end
99
100
 
100
- request = Request.new(nil, authority, path, headers, **options)
101
+ request = Request.new(scheme, authority, path, headers, **options)
101
102
 
102
103
  pool = @delegate.pool
103
104
  connection = pool.acquire
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
+ # Copyright, 2023, by Thomas Morgan.
5
6
 
6
7
  require 'protocol/http/request'
7
8
  require 'protocol/http/headers'
@@ -12,7 +13,7 @@ require 'async/variable'
12
13
 
13
14
  module Async
14
15
  module WebSocket
15
- # This is required for HTTP/1.x to upgrade the connection to the WebSocket protocol.
16
+ # This is required for HTTP/2 to establish a connection using the WebSocket protocol.
16
17
  # See https://tools.ietf.org/html/rfc8441 for more details.
17
18
  class ConnectRequest < ::Protocol::HTTP::Request
18
19
  include ::Protocol::WebSocket::Headers
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
+ # Copyright, 2023, by Thomas Morgan.
5
6
 
6
7
  require 'protocol/http/middleware'
7
8
  require 'protocol/http/request'
@@ -16,13 +17,15 @@ require_relative 'error'
16
17
  module Async
17
18
  module WebSocket
18
19
  # This is required for HTTP/1.x to upgrade the connection to the WebSocket protocol.
20
+ # See https://tools.ietf.org/html/rfc6455
19
21
  class UpgradeRequest < ::Protocol::HTTP::Request
20
22
  include ::Protocol::WebSocket::Headers
21
23
 
22
24
  class Wrapper
23
- def initialize(response)
25
+ def initialize(response, verified:)
24
26
  @response = response
25
27
  @stream = nil
28
+ @verified = verified
26
29
  end
27
30
 
28
31
  def close
@@ -32,7 +35,7 @@ module Async
32
35
  attr_accessor :response
33
36
 
34
37
  def stream?
35
- @response.status == 101
38
+ @response.status == 101 && @verified
36
39
  end
37
40
 
38
41
  def status
@@ -73,8 +76,9 @@ module Async
73
76
  raise ProtocolError, "Invalid accept digest, expected #{expected_accept_digest.inspect}, got #{accept_digest.inspect}!"
74
77
  end
75
78
  end
79
+ verified = accept_digest && Array(response.protocol) == %w(websocket) && response.headers['connection']&.include?('upgrade')
76
80
 
77
- return Wrapper.new(response)
81
+ return Wrapper.new(response, verified: verified)
78
82
  end
79
83
  end
80
84
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
+ # Copyright, 2023, by Thomas Morgan.
5
6
 
6
7
  require 'async/http/body/hijack'
7
8
  require 'protocol/http/response'
@@ -18,7 +19,6 @@ module Async
18
19
 
19
20
  if accept_nounce = request.headers[SEC_WEBSOCKET_KEY]&.first
20
21
  headers.add(SEC_WEBSOCKET_ACCEPT, Nounce.accept_digest(accept_nounce))
21
- status = 101
22
22
 
23
23
  if protocol
24
24
  headers.add(SEC_WEBSOCKET_PROTOCOL, protocol)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2022, by Samuel Williams.
4
+ # Copyright, 2018-2023, by Samuel Williams.
5
5
 
6
6
  module Async
7
7
  module WebSocket
8
- VERSION = "0.25.0"
8
+ VERSION = "0.26.0"
9
9
  end
10
10
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2015-2022, by Samuel Williams.
4
+ # Copyright, 2015-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'websocket/version'
7
7
  require_relative 'websocket/server'
data/license.md CHANGED
@@ -9,6 +9,9 @@ Copyright, 2020-2021, by Olle Jonsson.
9
9
  Copyright, 2020, by Juan Antonio Martín Lucas.
10
10
  Copyright, 2021, by Gleb Sinyavskiy.
11
11
  Copyright, 2021, by Aurora Nockert.
12
+ Copyright, 2023, by Peter Runich.
13
+ Copyright, 2023, by Thomas Morgan.
14
+ Copyright, 2023, by Emily Love Mills.
12
15
 
13
16
  Permission is hereby granted, free of charge, to any person obtaining a copy
14
17
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -6,14 +6,26 @@ An asynchronous websocket client/server implementation for [HTTP/1](https://tool
6
6
 
7
7
  ## Usage
8
8
 
9
- Please see the [project documentation](https://socketry.github.io/async-websocket/) or serve it locally using `bake utopia:project:serve`.
9
+ Please see the [project documentation](https://socketry.github.io/async-websocket/) for more details.
10
+
11
+ - [Getting Started](https://socketry.github.io/async-websocket/guides/getting-started/index) - This guide shows you how to implement a basic client and server.
12
+
13
+ - [Rails Integration](https://socketry.github.io/async-websocket/guides/rails-integration/index) - This guide explains how to use `async-websocket` with `falcon`.
10
14
 
11
15
  ## Contributing
12
16
 
13
17
  We welcome contributions to this project.
14
18
 
15
- 1. Fork it
16
- 2. Create your feature branch (`git checkout -b my-new-feature`)
17
- 3. Commit your changes (`git commit -am 'Add some feature'`)
18
- 4. Push to the branch (`git push origin my-new-feature`)
19
- 5. Create new Pull Request
19
+ 1. Fork it.
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
21
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
22
+ 4. Push to the branch (`git push origin my-new-feature`).
23
+ 5. Create new Pull Request.
24
+
25
+ ### Developer Certificate of Origin
26
+
27
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
28
+
29
+ ### Contributor Covenant
30
+
31
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - destructobeam
9
9
  - Olle Jonsson
10
+ - Thomas Morgan
10
11
  - Aurora Nockert
11
12
  - Bryan Powell
13
+ - Emily Love Mills
12
14
  - Gleb Sinyavskiy
13
15
  - Janko Marohnić
14
16
  - Juan Antonio Martín Lucas
15
17
  - Michel Boaventura
18
+ - Peter Runich
16
19
  autorequire:
17
20
  bindir: bin
18
21
  cert_chain:
@@ -45,7 +48,7 @@ cert_chain:
45
48
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
46
49
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
47
50
  -----END CERTIFICATE-----
48
- date: 2023-03-08 00:00:00.000000000 Z
51
+ date: 2023-12-09 00:00:00.000000000 Z
49
52
  dependencies:
50
53
  - !ruby/object:Gem::Dependency
51
54
  name: async-http
@@ -95,70 +98,14 @@ dependencies:
95
98
  requirements:
96
99
  - - "~>"
97
100
  - !ruby/object:Gem::Version
98
- version: '0.10'
101
+ version: '0.11'
99
102
  type: :runtime
100
103
  prerelease: false
101
104
  version_requirements: !ruby/object:Gem::Requirement
102
105
  requirements:
103
106
  - - "~>"
104
107
  - !ruby/object:Gem::Version
105
- version: '0.10'
106
- - !ruby/object:Gem::Dependency
107
- name: bundler
108
- requirement: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '0'
113
- type: :development
114
- prerelease: false
115
- version_requirements: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: '0'
120
- - !ruby/object:Gem::Dependency
121
- name: covered
122
- requirement: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- type: :development
128
- prerelease: false
129
- version_requirements: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- - !ruby/object:Gem::Dependency
135
- name: sus
136
- requirement: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - "~>"
139
- - !ruby/object:Gem::Version
140
- version: '0.18'
141
- type: :development
142
- prerelease: false
143
- version_requirements: !ruby/object:Gem::Requirement
144
- requirements:
145
- - - "~>"
146
- - !ruby/object:Gem::Version
147
- version: '0.18'
148
- - !ruby/object:Gem::Dependency
149
- name: sus-fixtures-async-http
150
- requirement: !ruby/object:Gem::Requirement
151
- requirements:
152
- - - "~>"
153
- - !ruby/object:Gem::Version
154
- version: 0.2.3
155
- type: :development
156
- prerelease: false
157
- version_requirements: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: 0.2.3
108
+ version: '0.11'
162
109
  description:
163
110
  email:
164
111
  executables: []
@@ -185,7 +132,9 @@ files:
185
132
  homepage: https://github.com/socketry/async-websocket
186
133
  licenses:
187
134
  - MIT
188
- metadata: {}
135
+ metadata:
136
+ documentation_uri: https://socketry.github.io/async-websocket/
137
+ funding_uri: https://github.com/sponsors/ioquatix
189
138
  post_install_message:
190
139
  rdoc_options: []
191
140
  require_paths:
@@ -194,14 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
143
  requirements:
195
144
  - - ">="
196
145
  - !ruby/object:Gem::Version
197
- version: '0'
146
+ version: '3.0'
198
147
  required_rubygems_version: !ruby/object:Gem::Requirement
199
148
  requirements:
200
149
  - - ">="
201
150
  - !ruby/object:Gem::Version
202
151
  version: '0'
203
152
  requirements: []
204
- rubygems_version: 3.4.7
153
+ rubygems_version: 3.4.22
205
154
  signing_key:
206
155
  specification_version: 4
207
156
  summary: An async websocket library on top of websocket-driver.
metadata.gz.sig CHANGED
Binary file