Skip to content

[EventCore] emit_request_complete can result in UnicodeDecodeError: 'utf-8' codec can't decode byte issues #960

@abhinavsingh

Description

@abhinavsingh
roxy/core/acceptor/threadless.py:390> exception=UnicodeDecodeError('utf-8', b"0J\x02\x01\x01010\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\x04 \x03ys\x0e'VO\xc8\xa7\xf8\x9c\x90GO\xf2B\xa9\xf4\x0b\xc6\xf8\x0f\x8d\xbc&\x91\x8c\x07\xfc\xd9\x01\x88\x06\x05*\x03\x04\x05\x06\x02\x08k\xe5A\xf3\xd2\xb6\x9ec\x01\x01\x01", 12, 13, 'invalid start byte')>
Traceback (most recent call last):
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/core/acceptor/threadless.py", line 394, in _run_forever
    if await self._run_once():
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/core/acceptor/threadless.py", line 378, in _run_once
    teardown = task.result()
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/handler.py", line 180, in handle_events
    teardown = await self.handle_readables(readables)
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/handler.py", line 251, in handle_readables
    teardown = await super().handle_readables(readables)
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/core/base/tcp_server.py", line 121, in handle_readables
    r = self.handle_data(data)
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/handler.py", line 205, in handle_data
    if self._parse_first_request(data):
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/handler.py", line 328, in _parse_first_request
    output = self.plugin.on_request_complete()
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/proxy/server.py", line 489, in on_request_complete
    self.emit_request_complete()
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/http/proxy/server.py", line 889, in emit_request_complete
    'body': text_(self.request.body)
  File "/Users/abhinavsingh/Dev/lib/python3.9/proxy/common/utils.py", line 59, in text_
    return s.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x86 in position 12: invalid start byte

Metadata

Metadata

Assignees

Labels

BugBug report in proxy serverGood First IssueIssues for new contributors to pick-up

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions