Add test for frame spillover issue (#218, #230)#220
Conversation
|
I think the assertion is contrived and can be removed (it's not validating anything outside the function's scope). |
ad6b1db to
0714fb2
Compare
|
@tito looking for your comments |
56c38ee to
7a94b0a
Compare
|
Any ETA on this being merged? |
|
@bytesofmyself unfortunately it seems like this is not maintained until there's a new maintainer |
|
Commenting on this PR to show some appreciation, because this was an issue which was affecting me pretty badly. Thanks a lot for the fix. It would be nice if #222 would check on this as well. |
|
I used veersion 0.3.4 a long time without any problems. Is this pull request fixing this issue? Or is it another issue? |
|
@Serpens66 It is very likely if you are using SSL/TLS sockets, otherwise the only way of knowing is testing for yourself. |
7a94b0a to
2bf4d51
Compare
|
This seems to have been superseded by #239. I've rebased onto master so that this PR only adds tests for the frame spillover issue now. |
Travis has dropped support for Python 3.3, so drop it from .travis.yml so that builds succeed.
Signed-off-by: Asif Saif Uddin <auvipy@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds tests to verify proper handling of frame spillover in WebSocket communication when more data than expected is received.
- Introduces the test_spill_frame test to simulate the spillover condition
- Updates the CI configuration (.travis.yml) to include Python 3.5 support
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/test_websocket.py | Adds a new test (test_spill_frame) to verify frame spillover handling |
| .travis.yml | Adds Python 3.5 to the CI Python version matrix |
Comments suppressed due to low confidence (1)
test/test_websocket.py:203
- Consider adding an assertion to verify that the spillover data (b"spillover") remains buffered after processing the expected payload. This would ensure the test fully covers the frame spillover behavior.
ws.stream.parser.send.assert_called_once_with(data)
When Frame.parser is given more data than expected, the next frame's header +
contents can end up as part of the payload, causing a UTF-8 validation error, or
ends up being thrown away. This can happen in the SSL case if we read slowly and
allow the socket's buffer to fill up a little.
This commit fixes that by amending WebSocket.once() to only provide bytes <=
reading_buffer_size to the stream parser and keeping the rest in a buffer,
giving the Frame a chance to stop receiving data at a frame boundary.
Fixes: #218
Edit: This PR now only contains tests for the issue since the issue itself has been fixed by #239.