async-websocket 0.25.1 → 0.26.1

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: bb4efda230c28f10a467f0d90afc709359865ea08248b55b65ab9eef402d0c1a
4
+ data.tar.gz: 35be732098859b629fab5dff78dbb91b38ea52980c7c9ae9b7a8cf0421ad5a96
5
5
  SHA512:
6
- metadata.gz: a2c5191f686f762160be7d906b740a23edeba37b4a58597070fcf206d1e7930f284426bdbb5b22312653de9b70cfed645aa797872b63dbb028ae92c131b52e7f
7
- data.tar.gz: 74798b94270e22827a6762cb35d79bdb48265da513e99c85329e23ff6d6ad2d424558ce177f467d3a24b95ad98034b9d4502dc2a063f9ab2581d6dd9b601f5a5
6
+ metadata.gz: 2737cdcbe5ede4cd313f6b3ea73c43910d49089063ca4fb0eb9307460e4ee14115b1ab70e245359513d7961c32da86793c9e3761e68bbb042fc7425b0033697f
7
+ data.tar.gz: 6a897cce467e1e0a3e3a45e500da460e2e35c4e4ec5942290ff816bdf2fb6bd7c57d6a000df64d44a7ec3aed07470c9f46d20743d6ffff19312f2a61cbdb7db9
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,7 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2018-2023, by Samuel Williams.
5
- # Copyright, 2019, by destructobeam.
5
+ # Copyright, 2019, by Simon Crocker.
6
6
 
7
7
  require_relative 'connection'
8
8
  require_relative 'response'
@@ -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.1"
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
@@ -1,14 +1,17 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2015-2023, by Samuel Williams.
3
+ Copyright, 2015-2024, by Samuel Williams.
4
4
  Copyright, 2019, by Bryan Powell.
5
- Copyright, 2019, by destructobeam.
5
+ Copyright, 2019, by Simon Crocker.
6
6
  Copyright, 2019, by Michel Boaventura.
7
7
  Copyright, 2019, by Janko Marohnić.
8
8
  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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- - destructobeam
8
+ - Simon Crocker
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: 2024-04-24 00:00:00.000000000 Z
49
52
  dependencies:
50
53
  - !ruby/object:Gem::Dependency
51
54
  name: async-http
@@ -61,34 +64,20 @@ dependencies:
61
64
  - - "~>"
62
65
  - !ruby/object:Gem::Version
63
66
  version: '0.54'
64
- - !ruby/object:Gem::Dependency
65
- name: async-io
66
- requirement: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - "~>"
69
- - !ruby/object:Gem::Version
70
- version: '1.23'
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '1.23'
78
67
  - !ruby/object:Gem::Dependency
79
68
  name: protocol-rack
80
69
  requirement: !ruby/object:Gem::Requirement
81
70
  requirements:
82
71
  - - "~>"
83
72
  - !ruby/object:Gem::Version
84
- version: '0.1'
73
+ version: '0.5'
85
74
  type: :runtime
86
75
  prerelease: false
87
76
  version_requirements: !ruby/object:Gem::Requirement
88
77
  requirements:
89
78
  - - "~>"
90
79
  - !ruby/object:Gem::Version
91
- version: '0.1'
80
+ version: '0.5'
92
81
  - !ruby/object:Gem::Dependency
93
82
  name: protocol-websocket
94
83
  requirement: !ruby/object:Gem::Requirement
@@ -103,62 +92,6 @@ dependencies:
103
92
  - - "~>"
104
93
  - !ruby/object:Gem::Version
105
94
  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
95
  description:
163
96
  email:
164
97
  executables: []
@@ -185,7 +118,10 @@ files:
185
118
  homepage: https://github.com/socketry/async-websocket
186
119
  licenses:
187
120
  - MIT
188
- metadata: {}
121
+ metadata:
122
+ documentation_uri: https://socketry.github.io/async-websocket/
123
+ funding_uri: https://github.com/sponsors/ioquatix
124
+ source_code_uri: https://github.com/socketry/async-websocket.git
189
125
  post_install_message:
190
126
  rdoc_options: []
191
127
  require_paths:
@@ -194,15 +130,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
130
  requirements:
195
131
  - - ">="
196
132
  - !ruby/object:Gem::Version
197
- version: '0'
133
+ version: '3.1'
198
134
  required_rubygems_version: !ruby/object:Gem::Requirement
199
135
  requirements:
200
136
  - - ">="
201
137
  - !ruby/object:Gem::Version
202
138
  version: '0'
203
139
  requirements: []
204
- rubygems_version: 3.4.6
140
+ rubygems_version: 3.5.3
205
141
  signing_key:
206
142
  specification_version: 4
207
- summary: An async websocket library on top of websocket-driver.
143
+ summary: An async websocket library on top of protocol-websocket.
208
144
  test_files: []
metadata.gz.sig CHANGED
Binary file