fix websocket regression introduced in 7.0.1 (#4733)

This commit is contained in:
Maximilian Hils 2021-08-04 14:59:48 +02:00 committed by GitHub
parent 88374e958b
commit 53a916e39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -164,7 +164,7 @@ class WebsocketLayer(layer.Layer):
content = b"".join(src_ws.frame_buf)
fragmentizer = Fragmentizer(src_ws.frame_buf, is_text)
src_ws.frame_buf.clear()
src_ws.frame_buf = [b""]
message = websocket.WebSocketMessage(typ, from_client, content)
self.flow.websocket.messages.append(message)

View File

@ -95,8 +95,12 @@ def test_upgrade(tctx):
<< websocket.WebsocketMessageHook(flow)
>> reply()
<< SendData(tctx.client, b"\x82\nhello back")
>> DataReceived(tctx.client, masked_bytes(b"\x81\x0bhello again"))
<< websocket.WebsocketMessageHook(flow)
>> reply()
<< SendData(tctx.server, masked(b"\x81\x0bhello again"))
)
assert len(flow().websocket.messages) == 2
assert len(flow().websocket.messages) == 3
assert flow().websocket.messages[0].content == b"hello world"
assert flow().websocket.messages[0].from_client
assert flow().websocket.messages[0].type == Opcode.TEXT