Skip to content

Commit b2010a5

Browse files
committed
manually apply patch for 1002 -> 1005
1 parent c1eae07 commit b2010a5

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

ws4py/streaming.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,25 +259,24 @@ def receiver(self):
259259
break
260260

261261
elif frame.opcode == OPCODE_CLOSE:
262-
code = 1000
262+
code = 1005
263263
reason = ""
264264
if frame.payload_length == 0:
265-
self.closing = CloseControlMessage(code=1000)
265+
self.closing = CloseControlMessage(code=1005)
266266
elif frame.payload_length == 1:
267-
self.closing = CloseControlMessage(code=1002, reason='Payload has invalid length')
267+
self.closing = CloseControlMessage(code=1005, reason='Payload has invalid length')
268268
else:
269269
try:
270270
# at this stage, some_bytes have been unmasked
271271
# so actually are held in a bytearray
272272
code = int(unpack("!H", bytes(some_bytes[0:2]))[0])
273273
except struct.error:
274-
code = 1002
275274
reason = 'Failed at decoding closing code'
276275
else:
277276
# Those codes are reserved or plainly forbidden
278277
if code not in VALID_CLOSING_CODES and not (2999 < code < 5000):
279278
reason = 'Invalid Closing Frame Code: %d' % code
280-
code = 1002
279+
code = 1005
281280
elif frame.payload_length > 1:
282281
reason = some_bytes[2:] if frame.masking_key else frame.body[2:]
283282

0 commit comments

Comments
 (0)