Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket bad logic/error message #950

Closed
nludban opened this issue Jul 2, 2016 · 3 comments
Closed

WebSocket bad logic/error message #950

nludban opened this issue Jul 2, 2016 · 3 comments
Labels

Comments

@nludban
Copy link

nludban commented Jul 2, 2016

Long story short

With an aiohttp.ClientSession and ws_connect to an embedded data acquisition device, my application got a message of type aiohttp.MsgType.error:

Message(tp=<MsgType.error: 21>, data=WebSocketError('Received new fragment frame with non-zero opcode 0',), extra=None)

Which is generated in websocket.py parse_frame:

``'python
if fin == 0 and opcode == OPCODE_CONTINUATION and not continuation:
raise WebSocketError(
CLOSE_PROTOCOL_ERROR,
'Received new fragment frame with non-zero '
'opcode {!r}'.format(opcode))



## Expected behaviour

Provide a self-consistent error message.  Possibly correct some logic.  (It's very believable that the embedded device is actually sending bad frames.)

## Actual behaviour

Given that OPCODE_CONTINUATION = 0x0, the only message this block of code can deliver is that there's a non-zero opcode of constant value zero...

## Steps to reproduce

<!-- Please describe steps to reproduce the issue.
     If you have a script that does that please include it here within
     markdown code markup -->

## Your environment

Observed in aiohttp-0.21.6, this function does not appear to have any changes in the latest code.

@nludban
Copy link
Author

nludban commented Jul 2, 2016

Verified with tcpdump that the peer incorrectly inserted two octets of zero in the TCP stream.

Suggest replacing the error message "Received new fragment frame with non-zero opcode {!r}." with "Received continuation fragment as start of new frame."

@asvetlov
Copy link
Member

Sorry, I think the value for proposed change is not high, new text is still now clean.
It means "something is broken in protocol structure", nothing more.

I believe the error is very rare, thus I want to do nothing with it.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants