Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: net/websockets/websocket_basic_stream.cc

Issue 171883002: Clear reserved flags on synthetic continuations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/websockets/websocket_basic_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_basic_stream.cc
diff --git a/net/websockets/websocket_basic_stream.cc b/net/websockets/websocket_basic_stream.cc
index 8d1fa87cb9f4ca69db75fab6a7c4a6f2486687f0..fd2766bcb94fceffe2ba9e29e3637705bc951839 100644
--- a/net/websockets/websocket_basic_stream.cc
+++ b/net/websockets/websocket_basic_stream.cc
@@ -378,9 +378,16 @@ scoped_ptr<WebSocketFrame> WebSocketBasicStream::CreateFrame(
result_frame->header.payload_length = data_size;
result_frame->data = data;
// Ensure that opcodes Text and Binary are only used for the first frame in
- // the message.
- if (WebSocketFrameHeader::IsKnownDataOpCode(opcode))
+ // the message. Also clear the reserved bits.
+ // TODO(ricea): If a future extension requires the reserved bits to be
+ // retained on continuation frames, make this behaviour conditional on a
+ // flag set at construction time.
+ if (!is_final_chunk && WebSocketFrameHeader::IsKnownDataOpCode(opcode)) {
tyoshino (SeeGerritForStatus) 2014/02/19 05:19:19 addition of !is_final_chunk is just a small optimi
Adam Rice 2014/02/19 05:26:14 Yes, exactly.
current_frame_header_->opcode = WebSocketFrameHeader::kOpCodeContinuation;
+ current_frame_header_->reserved1 = false;
+ current_frame_header_->reserved2 = false;
+ current_frame_header_->reserved3 = false;
+ }
}
// Make sure that a frame header is not applied to any chunks that do not
// belong to it.
« no previous file with comments | « no previous file | net/websockets/websocket_basic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698