protocol-websocket 0.19.1 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/websocket/frame.rb +1 -0
- data/lib/protocol/websocket/framer.rb +7 -1
- data/lib/protocol/websocket/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: c0f42ab3d5253103ee0a3bc0b3b6ad1ba09c34cd05aa0ae8abcad14cf41889f5
|
4
|
+
data.tar.gz: e543425bcc0219da7de6d8bf25c55cb27e2065ab3848090a0464558d929c1e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f5c67e456e61dceab5407edc739e6c14c165f9d9e123459c64d307c4573f8db2d8ac441d13e009bdbfba34a2d5342db314a03d97635816be6a1031b156f401
|
7
|
+
data.tar.gz: 268a562e395ae6bfbe2460881af7fe81a549ee43f1a95e2039250a8d50d15b217a2d1a251ca56e59e5b33866f1ecfc16b3b8efb861f4d15a449e07f8df1ddfe9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -23,6 +23,7 @@ module Protocol
|
|
23
23
|
# @parameter mask [Boolean | String] An optional 4-byte string which is used to mask the payload.
|
24
24
|
def initialize(finished = true, payload = nil, flags: 0, opcode: self.class::OPCODE, mask: false)
|
25
25
|
if mask == true
|
26
|
+
# Generate a unique mask for each frame:
|
26
27
|
mask = SecureRandom.bytes(4)
|
27
28
|
end
|
28
29
|
|
@@ -29,9 +29,11 @@ module Protocol
|
|
29
29
|
|
30
30
|
# Wraps an underlying {Async::IO::Stream} for reading and writing binary data into structured frames.
|
31
31
|
class Framer
|
32
|
-
def initialize(stream, frames = FRAMES)
|
32
|
+
def initialize(stream, frames = FRAMES, requires_masking: false)
|
33
33
|
@stream = stream
|
34
34
|
@frames = frames
|
35
|
+
|
36
|
+
@requires_masking = requires_masking
|
35
37
|
end
|
36
38
|
|
37
39
|
# Close the underlying stream.
|
@@ -54,6 +56,10 @@ module Protocol
|
|
54
56
|
klass = @frames[opcode] || Frame
|
55
57
|
frame = klass.read(finished, flags, opcode, @stream, maximum_frame_size)
|
56
58
|
|
59
|
+
if @requires_masking and !frame.mask
|
60
|
+
raise ProtocolError, "Received unmasked frame but requires masking!"
|
61
|
+
end
|
62
|
+
|
57
63
|
return frame
|
58
64
|
end
|
59
65
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|