-
-
Notifications
You must be signed in to change notification settings - Fork 616
Open
Labels
BugBug report in proxy serverBug report in proxy serverGood First IssueIssues for new contributors to pick-upIssues for new contributors to pick-up
Description
Describe the bug
When building a WebSocket frame with very large payload (8 bytes represented as 64-bit unsigned integer as payload length)
, following exception is seen:
2021-12-27 21:11:52,797 - pid:75191 [E] base_events.default_exception_handler:1729 - Task exception was never retrieved
future: <Task finished name='Task-1' coro=<Threadless._run_forever() done, defined at /Users/abhinavsingh/Dev/proxy.py/proxy/core/acceptor/threadless.py:346> exception=error('pack expected 3 items for packing (got 2)')>
Traceback (most recent call last):
File "/Users/abhinavsingh/Dev/proxy.py/proxy/core/acceptor/threadless.py", line 350, in _run_forever
if await self._run_once():
File "/Users/abhinavsingh/Dev/proxy.py/proxy/core/acceptor/threadless.py", line 334, in _run_once
teardown = task.result()
File "/Users/abhinavsingh/Dev/proxy.py/proxy/http/handler.py", line 192, in handle_events
teardown = await plugin.read_from_descriptors(readables)
File "/Users/abhinavsingh/Dev/proxy.py/proxy/http/proxy/server.py", line 299, in read_from_descriptors
raw = plugin.handle_upstream_chunk(raw)
File "/Users/abhinavsingh/Dev/proxy.py/proxy/plugin/modify_websocket_response.py", line 32, in handle_upstream_chunk
self.client.queue(memoryview(self.response.build()))
File "/Users/abhinavsingh/Dev/proxy.py/proxy/http/websocket/frame.py", line 161, in build
struct.pack(
struct.error: pack expected 3 items for packing (got 2)
To Reproduce
Steps to reproduce the behavior:
- Start
proxy.py
./helper/chrome_with_proxy.sh
- See exception in console
Expected behavior
There seems to be a typo error here:
elif self.payload_length < 1 << 64:
raw.write(
struct.pack(
'!BHQ',
(1 << 7 if self.masked else 0) | 127,
self.payload_length,
),
)
We simply want !BQ
and not !BHQ
. But need to double check with spec and write tests for it. Opening this issue to track the same.
Metadata
Metadata
Assignees
Labels
BugBug report in proxy serverBug report in proxy serverGood First IssueIssues for new contributors to pick-upIssues for new contributors to pick-up