Remove code left over from a previous edit that was breaking fragment handling

This commit is contained in:
Kovid Goyal 2015-10-25 23:28:46 +05:30
parent 51f0e93be5
commit f7be2cc60f
2 changed files with 6 additions and 10 deletions

View File

@ -251,3 +251,9 @@ class WebSocketTest(BaseTest):
{'opcode':opcode, 'payload':'f1', 'fin':0}, {'opcode':opcode, 'payload':'f2'} {'opcode':opcode, 'payload':'f1', 'fin':0}, {'opcode':opcode, 'payload':'f2'}
], close_code=PROTOCOL_ERROR, send_close=False) ], close_code=PROTOCOL_ERROR, send_close=False)
fragments = 'frag1 frag2'.split()
client = server.connect()
self.simple_test(client, [
{'opcode':TEXT, 'payload':fragments[0], 'fin':0}, {'opcode':TEXT, 'payload':fragments[1]}
], [''.join(fragments)])

View File

@ -317,16 +317,6 @@ class WebSocketConnection(HTTPConnection):
message_starting = self.current_recv_opcode is None message_starting = self.current_recv_opcode is None
if message_starting: if message_starting:
self.current_recv_opcode = opcode self.current_recv_opcode = opcode
else:
if opcode != CONTINUATION:
# This is a new message
try:
self.handle_websocket_data('' if self.current_recv_opcode == TEXT else b'', False, True)
except Exception as err:
self.log.exception('Error in WebSockets data handler:')
self.websocket_close(UNEXPECTED_ERROR, 'Unexpected error in handler: %r' % as_unicode(err))
self.current_recv_opcode = opcode
message_starting = True
message_finished = frame_finished and is_final_frame_of_message message_finished = frame_finished and is_final_frame_of_message
if message_finished: if message_finished:
self.current_recv_opcode = None self.current_recv_opcode = None