async-websocket 0.25.1 → 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: 6e4a0133507e63cd2fcedbf71f231eef6b331cae9529992956372290ad943060
4
- data.tar.gz: 22d2f1802dca3fd0e371ae36b9a51250d3ed6f233c6ef4b52b997d674d3de5ac
3
+ metadata.gz: ee54a400cc9103d9fb64852edc368fed4c0f288d5e78b72656375a3dfb4c28ed
4
+ data.tar.gz: f58fdc2b051e0ae052b6b4ee1e68b0f31c70fc720d30733365669f719a178adc
5
5
  SHA512:
6
- metadata.gz: a2c5191f686f762160be7d906b740a23edeba37b4a58597070fcf206d1e7930f284426bdbb5b22312653de9b70cfed645aa797872b63dbb028ae92c131b52e7f
7
- data.tar.gz: 74798b94270e22827a6762cb35d79bdb48265da513e99c85329e23ff6d6ad2d424558ce177f467d3a24b95ad98034b9d4502dc2a063f9ab2581d6dd9b601f5a5
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.1"
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.1
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-04-02 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
@@ -103,62 +106,6 @@ dependencies:
103
106
  - - "~>"
104
107
  - !ruby/object:Gem::Version
105
108
  version: '0.11'
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
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.6
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