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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cece8e2514c6533d37a93e91d3937f0f8b440a862d915c5c83e555893d7e816
4
- data.tar.gz: 6c674f5eb43241639c08d0e6b24fcf4267e4728db2989bf4c7cb422589f81875
3
+ metadata.gz: c0f42ab3d5253103ee0a3bc0b3b6ad1ba09c34cd05aa0ae8abcad14cf41889f5
4
+ data.tar.gz: e543425bcc0219da7de6d8bf25c55cb27e2065ab3848090a0464558d929c1e79
5
5
  SHA512:
6
- metadata.gz: 553b22466d3e1578ed5b65a1aeb94f882b46adecd8f106f3280e7f23f0eb0334b3920bc5709c61c55d1a2b4719fb414476da6b39b24c8cdc0c31b9dff8a471db
7
- data.tar.gz: 3c1273115018f1179421e5a7aa91d32bbf0ab48fb41ee42f9322cecf5efff93c3f3725d7a0cdcc7de50d3e4f4a366ed9576fde9b370e99065642aec1fe8c83b4
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
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module WebSocket
8
- VERSION = "0.19.1"
8
+ VERSION = "0.20.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file