Fix bug in WebSocketProtocol.asgi_receive
#1272
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@euri10 @Kludex
There were 2 things to fix in #1230:
The first item was fixed was fixed by this PR: #1252. But I realized after this PR was merged that the second item hadn't been fixed.
This PR fixes the second item. It ensures that the server can "drain" unread frames in the read queue even after the server has sent the close frame, as long as those frames were sent before the server sent the close frame.
As with the first item, the second item is part of the websockets spec. The following code, using just the
websockets
library, makes it clear that this is the intended behavior of this library.I did not include code in this PR that fixes this bug in
wsproto_impl.py
, because I'm not familiar withwsproto
. That said, I don't think we should gate this fix on the corresponding fix inwsproto
.client.py
server.py