protocol-websocket 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -3
- data/lib/protocol/websocket/binary_frame.rb +5 -19
- data/lib/protocol/websocket/close_frame.rb +15 -28
- data/lib/protocol/websocket/connection.rb +39 -38
- data/lib/protocol/websocket/continuation_frame.rb +4 -19
- data/lib/protocol/websocket/error.rb +4 -19
- data/lib/protocol/websocket/extension/compression/constants.rb +4 -19
- data/lib/protocol/websocket/extension/compression/deflate.rb +10 -24
- data/lib/protocol/websocket/extension/compression/inflate.rb +12 -22
- data/lib/protocol/websocket/extension/compression.rb +6 -21
- data/lib/protocol/websocket/extensions.rb +4 -19
- data/lib/protocol/websocket/frame.rb +10 -23
- data/lib/protocol/websocket/framer.rb +5 -20
- data/lib/protocol/websocket/headers.rb +4 -19
- data/lib/protocol/websocket/json_message.rb +4 -19
- data/lib/protocol/websocket/message.rb +4 -19
- data/lib/protocol/websocket/ping_frame.rb +4 -19
- data/lib/protocol/websocket/pong_frame.rb +4 -19
- data/lib/protocol/websocket/text_frame.rb +5 -19
- data/lib/protocol/websocket/version.rb +5 -20
- data/lib/protocol/websocket.rb +4 -19
- data/license.md +25 -0
- data/readme.md +19 -0
- data.tar.gz.sig +0 -0
- metadata +8 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58b07db9f128f30d49b779a04a08624afbeb59abe9cc3e0028ded1e2d5e6a7f3
|
4
|
+
data.tar.gz: 646c2a5004051f46d6f4872fec0842d695d6e4a1b2273421bc164293315df4e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f28c28daa4dc109df788ae226c4b9a0a1081d20a2316a4e23ff48e1632dd9662a32c2bad2573fed32cde1624c7ab7c23a53b805e946068a70543f93b188cbf
|
7
|
+
data.tar.gz: 0d64b3c9f3d809bd6b965b15780be053c15cfc37ff7fc5c66d0d7dc73e614821550ee25746f6a4b28b9c6f69603254daa3f4bd83b63e4cd5dbe8b4f223be9ab6
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
l��ҭ��V4�$C==N�*$���D�e�Z�8j�k��.�a<!���Ih�Z��8�mˋ4����m@�"sk�58Gؒ�
|
2
|
+
=~�{�!�ַu�WY����M�F�
|
3
|
+
����nG~�b�o�4#�3��響`�K���Y�����9.�λ��J��b�虎�;r1�5�����y,0�J��od���I���� y���X�\V +��|R-g�7��E�t����n����c���q��n�5�8u{'��6wY1�v��L���Vڤ�l��!ߤ���$��Ի�.b�$����b'bٳ��'HbJ^�!���Q��Yeb���j�܍=F�-8�!VT��o����*��$���g�d�&�O��-I|HB
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
require_relative 'message'
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
|
@@ -31,38 +17,39 @@ module Protocol
|
|
31
17
|
|
32
18
|
case data.length
|
33
19
|
when 0
|
34
|
-
[nil,
|
20
|
+
[nil, nil]
|
35
21
|
when 1
|
36
|
-
raise ProtocolError, "
|
22
|
+
raise ProtocolError, "Invalid close frame length!"
|
37
23
|
else
|
38
24
|
code, reason = *data.unpack(FORMAT)
|
39
25
|
|
40
26
|
case code
|
41
27
|
when 0 .. 999, 1005 .. 1006, 1015, 5000 .. 0xFFFF
|
42
|
-
raise ProtocolError, "
|
28
|
+
raise ProtocolError, "Invalid close code!"
|
43
29
|
when 1004, 1016 .. 2999
|
44
|
-
raise ProtocolError, "
|
30
|
+
raise ProtocolError, "Reserved close code!"
|
45
31
|
end
|
46
32
|
|
47
33
|
reason.force_encoding(Encoding::UTF_8)
|
48
34
|
|
49
35
|
unless reason.valid_encoding?
|
50
|
-
raise ProtocolError, "
|
36
|
+
raise ProtocolError, "Invalid UTF-8 in close reason!"
|
51
37
|
end
|
52
38
|
|
53
39
|
[code, reason]
|
54
40
|
end
|
55
41
|
end
|
56
42
|
|
57
|
-
|
43
|
+
# If code is missing, reason is ignored.
|
44
|
+
def pack(code = nil, reason = nil)
|
58
45
|
if code
|
59
|
-
|
46
|
+
if reason and reason.encoding != Encoding::UTF_8
|
60
47
|
reason = reason.encode(Encoding::UTF_8)
|
61
48
|
end
|
62
49
|
|
63
|
-
super
|
50
|
+
super([code, reason].pack(FORMAT))
|
64
51
|
else
|
65
|
-
super
|
52
|
+
super()
|
66
53
|
end
|
67
54
|
end
|
68
55
|
|
@@ -1,22 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2019, by William T. Nelson.
|
6
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
7
|
|
21
8
|
require_relative 'framer'
|
22
9
|
require 'securerandom'
|
@@ -56,10 +43,10 @@ module Protocol
|
|
56
43
|
|
57
44
|
def reserve!(bit)
|
58
45
|
if (@reserved & bit).zero?
|
59
|
-
raise "Unable to use #{bit}!"
|
46
|
+
raise ArgumentError, "Unable to use #{bit}!"
|
60
47
|
end
|
61
48
|
|
62
|
-
@reserved
|
49
|
+
@reserved &= ~bit
|
63
50
|
|
64
51
|
return true
|
65
52
|
end
|
@@ -68,12 +55,32 @@ module Protocol
|
|
68
55
|
@framer.flush
|
69
56
|
end
|
70
57
|
|
58
|
+
def open!
|
59
|
+
@state = :open
|
60
|
+
|
61
|
+
return self
|
62
|
+
end
|
63
|
+
|
64
|
+
def close!(...)
|
65
|
+
@state = :closed
|
66
|
+
|
67
|
+
return self
|
68
|
+
end
|
69
|
+
|
71
70
|
def closed?
|
72
71
|
@state == :closed
|
73
72
|
end
|
74
73
|
|
75
|
-
def close(
|
76
|
-
|
74
|
+
def close(...)
|
75
|
+
unless @state == :closed
|
76
|
+
close!
|
77
|
+
|
78
|
+
begin
|
79
|
+
send_close(...)
|
80
|
+
rescue
|
81
|
+
# Ignore.
|
82
|
+
end
|
83
|
+
end
|
77
84
|
|
78
85
|
@framer.close
|
79
86
|
end
|
@@ -93,11 +100,11 @@ module Protocol
|
|
93
100
|
|
94
101
|
return frame
|
95
102
|
rescue ProtocolError => error
|
96
|
-
|
103
|
+
close(error.code, error.message)
|
97
104
|
|
98
105
|
raise
|
99
106
|
rescue
|
100
|
-
|
107
|
+
close(Error::PROTOCOL_ERROR, $!.message)
|
101
108
|
|
102
109
|
raise
|
103
110
|
end
|
@@ -133,11 +140,13 @@ module Protocol
|
|
133
140
|
end
|
134
141
|
|
135
142
|
def receive_close(frame)
|
136
|
-
@state = :closed
|
137
|
-
|
138
143
|
code, reason = frame.unpack
|
139
144
|
|
140
|
-
|
145
|
+
# If we're already closed, then we don't need to send a close frame. Otherwise, according to the RFC, we should echo the close frame. However, it's possible it will fail to send if the connection is already closed.
|
146
|
+
unless @state == :closed
|
147
|
+
close!
|
148
|
+
send_close(code, reason)
|
149
|
+
end
|
141
150
|
|
142
151
|
if code and code != Error::NO_ERROR
|
143
152
|
raise ClosedError.new reason, code
|
@@ -155,12 +164,6 @@ module Protocol
|
|
155
164
|
end
|
156
165
|
end
|
157
166
|
|
158
|
-
def open!
|
159
|
-
@state = :open
|
160
|
-
|
161
|
-
return self
|
162
|
-
end
|
163
|
-
|
164
167
|
def receive_ping(frame)
|
165
168
|
if @state != :closed
|
166
169
|
write_frame(frame.reply(mask: @mask))
|
@@ -174,7 +177,7 @@ module Protocol
|
|
174
177
|
end
|
175
178
|
|
176
179
|
def receive_frame(frame)
|
177
|
-
|
180
|
+
raise ProtocolError, "Unhandled frame: #{frame}"
|
178
181
|
end
|
179
182
|
|
180
183
|
def pack_text_frame(buffer, **options)
|
@@ -205,8 +208,6 @@ module Protocol
|
|
205
208
|
|
206
209
|
self.write_frame(frame)
|
207
210
|
self.flush
|
208
|
-
|
209
|
-
@state = :closed
|
210
211
|
end
|
211
212
|
|
212
213
|
# Write a message to the connection.
|
@@ -244,7 +245,7 @@ module Protocol
|
|
244
245
|
end
|
245
246
|
end
|
246
247
|
rescue ProtocolError => error
|
247
|
-
|
248
|
+
close(error.code, error.message)
|
248
249
|
|
249
250
|
raise
|
250
251
|
end
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'protocol/http/error'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'zlib'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'constants'
|
22
7
|
|
@@ -51,16 +36,17 @@ module Protocol
|
|
51
36
|
@level = level
|
52
37
|
@memory_level = memory_level
|
53
38
|
@strategy = strategy
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
39
|
+
|
40
|
+
# This is handled during negotiation:
|
41
|
+
# if window_bits < MINIMUM_WINDOW_BITS
|
42
|
+
# window_bits = MINIMUM_WINDOW_BITS
|
43
|
+
# end
|
58
44
|
|
59
45
|
@window_bits = window_bits
|
60
46
|
@context_takeover = context_takeover
|
61
47
|
end
|
62
48
|
|
63
|
-
def
|
49
|
+
def to_s
|
64
50
|
"#<#{self.class} window_bits=#{@window_bits} context_takeover=#{@context_takeover}>"
|
65
51
|
end
|
66
52
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'constants'
|
22
7
|
|
@@ -48,14 +33,19 @@ module Protocol
|
|
48
33
|
|
49
34
|
@inflate = nil
|
50
35
|
|
51
|
-
|
52
|
-
|
53
|
-
|
36
|
+
# This is handled during negotiation:
|
37
|
+
# if window_bits < MINIMUM_WINDOW_BITS
|
38
|
+
# window_bits = MINIMUM_WINDOW_BITS
|
39
|
+
# end
|
54
40
|
|
55
41
|
@window_bits = window_bits
|
56
42
|
@context_takeover = context_takeover
|
57
43
|
end
|
58
44
|
|
45
|
+
def to_s
|
46
|
+
"#<#{self.class} window_bits=#{@window_bits} context_takeover=#{@context_takeover}>"
|
47
|
+
end
|
48
|
+
|
59
49
|
attr :window_bits
|
60
50
|
attr :context_takeover
|
61
51
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'compression/constants'
|
22
7
|
require_relative 'compression/inflate'
|
@@ -86,7 +71,7 @@ module Protocol
|
|
86
71
|
options[:client_max_window_bits] = value
|
87
72
|
header << "client_max_window_bits=#{value}"
|
88
73
|
else
|
89
|
-
raise ArgumentError, "Unknown option #{key}!"
|
74
|
+
raise ArgumentError, "Unknown option: #{key}!"
|
90
75
|
end
|
91
76
|
end
|
92
77
|
|
@@ -117,7 +102,7 @@ module Protocol
|
|
117
102
|
when "client_max_window_bits"
|
118
103
|
options[:client_max_window_bits] = Integer(value || 15)
|
119
104
|
else
|
120
|
-
raise ArgumentError, "Unknown option #{key}!"
|
105
|
+
raise ArgumentError, "Unknown option: #{key}!"
|
121
106
|
end
|
122
107
|
end
|
123
108
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'extension/compression'
|
22
7
|
require_relative 'headers'
|
@@ -1,22 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2019, by Soumya.
|
6
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
7
|
|
21
8
|
require_relative 'error'
|
22
9
|
|
@@ -99,7 +86,7 @@ module Protocol
|
|
99
86
|
attr_accessor :length
|
100
87
|
attr_accessor :payload
|
101
88
|
|
102
|
-
def pack(data)
|
89
|
+
def pack(data = "")
|
103
90
|
length = data.bytesize
|
104
91
|
|
105
92
|
if length.bit_length > 63
|
@@ -148,9 +135,9 @@ module Protocol
|
|
148
135
|
opcode = byte & 0b0000_1111
|
149
136
|
|
150
137
|
if (0x3 .. 0x7).include?(opcode)
|
151
|
-
raise ProtocolError, "
|
138
|
+
raise ProtocolError, "Non-control opcode = #{opcode} is reserved!"
|
152
139
|
elsif (0xB .. 0xF).include?(opcode)
|
153
|
-
raise ProtocolError, "
|
140
|
+
raise ProtocolError, "Control opcode = #{opcode} is reserved!"
|
154
141
|
end
|
155
142
|
|
156
143
|
return finished, flags, opcode
|
@@ -190,7 +177,7 @@ module Protocol
|
|
190
177
|
payload = stream.read(length) or raise EOFError, "Could not read payload!"
|
191
178
|
|
192
179
|
if payload.bytesize != length
|
193
|
-
raise EOFError, "Incorrect payload length: #{@length} != #{
|
180
|
+
raise EOFError, "Incorrect payload length: #{@length} != #{payload.bytesize}!"
|
194
181
|
end
|
195
182
|
|
196
183
|
return self.new(finished, payload, flags: flags, opcode: opcode, mask: mask)
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -75,7 +60,7 @@ module Protocol
|
|
75
60
|
end
|
76
61
|
|
77
62
|
def read_header
|
78
|
-
if buffer = @stream.read(1)
|
63
|
+
if buffer = @stream.read(1) and buffer.bytesize == 1
|
79
64
|
return Frame.parse_header(buffer)
|
80
65
|
end
|
81
66
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'digest/sha1'
|
22
7
|
require 'securerandom'
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'json'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
require_relative 'pong_frame'
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
require_relative 'message'
|
@@ -1,25 +1,10 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
module Protocol
|
22
7
|
module WebSocket
|
23
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.11.0"
|
24
9
|
end
|
25
10
|
end
|
data/lib/protocol/websocket.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'websocket/version'
|
22
7
|
require_relative 'websocket/framer'
|
data/license.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2019-2023, by Samuel Williams.
|
4
|
+
Copyright, 2019, by Soumya.
|
5
|
+
Copyright, 2019, by William T. Nelson.
|
6
|
+
Copyright, 2020, by Olle Jonsson.
|
7
|
+
Copyright, 2021, by Aurora Nockert.
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
11
|
+
in the Software without restriction, including without limitation the rights
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
14
|
+
furnished to do so, subject to the following conditions:
|
15
|
+
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
17
|
+
copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
25
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Protocol::WebSocket
|
2
|
+
|
3
|
+
Provides a low-level implementation of the WebSocket protocol according to [RFC6455](https://tools.ietf.org/html/rfc6455). It only implements the latest stable version (13).
|
4
|
+
|
5
|
+
[](https://github.com/socketry/protocol-websocket/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Please see the [project documentation](https://socketry.github.io/protocol-websocket).
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
We welcome contributions to this project.
|
14
|
+
|
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.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
- Aurora
|
8
|
+
- Aurora Nockert
|
9
9
|
- Soumya
|
10
10
|
- Olle Jonsson
|
11
11
|
- William T. Nelson
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
42
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
43
|
-----END CERTIFICATE-----
|
44
|
-
date:
|
44
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: protocol-http
|
@@ -105,14 +105,14 @@ dependencies:
|
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.
|
108
|
+
version: '0.16'
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
115
|
+
version: '0.16'
|
116
116
|
description:
|
117
117
|
email:
|
118
118
|
executables: []
|
@@ -142,6 +142,8 @@ files:
|
|
142
142
|
- lib/protocol/websocket/pong_frame.rb
|
143
143
|
- lib/protocol/websocket/text_frame.rb
|
144
144
|
- lib/protocol/websocket/version.rb
|
145
|
+
- license.md
|
146
|
+
- readme.md
|
145
147
|
homepage: https://github.com/socketry/protocol-websocket
|
146
148
|
licenses:
|
147
149
|
- MIT
|
@@ -161,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
163
|
- !ruby/object:Gem::Version
|
162
164
|
version: '0'
|
163
165
|
requirements: []
|
164
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.4.6
|
165
167
|
signing_key:
|
166
168
|
specification_version: 4
|
167
169
|
summary: A low level implementation of the WebSocket protocol.
|
metadata.gz.sig
CHANGED
Binary file
|