forked from chromium/chromium
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix internal WebSocket server's handling of interleaved control frames
In the previous implementation, if ping or pong frames were sent between text frame and continuation frame, the WebSocket encoder didn't handle the fragmented message correctly (e.g. text -> ping -> continuation, text -> continuation -> pong -> continuation) In this case, the parts of the message before the ping or pong frames were lost, so only the following parts were passed to the HttpServer::Delegate. To solve this problem, this CL switches the method of processing messages in WebSocketEncoder::DecodeFrame() based on the type of frame. For text and continuation frames, the message is buffered until the end of the message, and no longer cleared if ping or pong frames are received. On the other hand, for ping frames, the contents are passed back directly and not buffered. To check this implementation works correctly, add tests which send text or ping frames in various orders. This is a copy of https://chromium-review.googlesource.com/c/chromium/src/+/3209721 by Shiho Noda. Bug: 1226710 Change-Id: I4ec52e72866e2ce534d654233babc0e07d886622 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3220895 Reviewed-by: Yoichi Osato <[email protected]> Commit-Queue: Adam Rice <[email protected]> Cr-Commit-Position: refs/heads/main@{#935349}
- Loading branch information
Showing
2 changed files
with
300 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters