Skip to content

Commit

Permalink
Fix client mask generation
Browse files Browse the repository at this point in the history
random.randrange() gives integers, which need to be explicitly converted
to bytes.
  • Loading branch information
CendioOssman committed May 20, 2024
1 parent bccf1dd commit a2362da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion websockify/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ def _sendmsg(self, opcode, msg):
if self.client:
mask = b''
for i in range(4):
mask += random.randrange(256)
mask += random.randrange(256).to_bytes()
frame = self._encode_hybi(opcode, msg, mask)
else:
frame = self._encode_hybi(opcode, msg)
Expand Down

0 comments on commit a2362da

Please sign in to comment.