mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
fix websocket regression introduced in 7.0.1 (#4733)
This commit is contained in:
parent
88374e958b
commit
53a916e39b
@ -164,7 +164,7 @@ class WebsocketLayer(layer.Layer):
|
|||||||
content = b"".join(src_ws.frame_buf)
|
content = b"".join(src_ws.frame_buf)
|
||||||
|
|
||||||
fragmentizer = Fragmentizer(src_ws.frame_buf, is_text)
|
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)
|
message = websocket.WebSocketMessage(typ, from_client, content)
|
||||||
self.flow.websocket.messages.append(message)
|
self.flow.websocket.messages.append(message)
|
||||||
|
@ -95,8 +95,12 @@ def test_upgrade(tctx):
|
|||||||
<< websocket.WebsocketMessageHook(flow)
|
<< websocket.WebsocketMessageHook(flow)
|
||||||
>> reply()
|
>> reply()
|
||||||
<< SendData(tctx.client, b"\x82\nhello back")
|
<< 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].content == b"hello world"
|
||||||
assert flow().websocket.messages[0].from_client
|
assert flow().websocket.messages[0].from_client
|
||||||
assert flow().websocket.messages[0].type == Opcode.TEXT
|
assert flow().websocket.messages[0].type == Opcode.TEXT
|
||||||
|
Loading…
Reference in New Issue
Block a user