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

Side by Side Diff: net/websockets/websocket_channel.h

Issue 157033013: Check for invalid use of data frame opcodes. (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 unified diff | Download patch
« no previous file with comments | « no previous file | net/websockets/websocket_channel.cc » ('j') | net/websockets/websocket_channel.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 scoped_ptr<WebSocketFrame> frame) WARN_UNUSED_RESULT; 193 scoped_ptr<WebSocketFrame> frame) WARN_UNUSED_RESULT;
194 194
195 // Handles a frame that the object has received enough of to process. May call 195 // Handles a frame that the object has received enough of to process. May call
196 // |event_interface_| methods, send responses to the server, and change the 196 // |event_interface_| methods, send responses to the server, and change the
197 // value of |state_|. 197 // value of |state_|.
198 ChannelState HandleFrame(const WebSocketFrameHeader::OpCode opcode, 198 ChannelState HandleFrame(const WebSocketFrameHeader::OpCode opcode,
199 bool final, 199 bool final,
200 const scoped_refptr<IOBuffer>& data_buffer, 200 const scoped_refptr<IOBuffer>& data_buffer,
201 size_t size) WARN_UNUSED_RESULT; 201 size_t size) WARN_UNUSED_RESULT;
202 202
203 // Forward a received data frame to the renderer, if connected. Checks the
204 // UTF-8 validity of text frames.
205 ChannelState HandleDataFrame(const WebSocketFrameHeader::OpCode opcode,
206 bool final,
207 const scoped_refptr<IOBuffer>& data_buffer,
208 size_t size);
209
203 // Low-level method to send a single frame. Used for both data and control 210 // Low-level method to send a single frame. Used for both data and control
204 // frames. Either sends the frame immediately or buffers it to be scheduled 211 // frames. Either sends the frame immediately or buffers it to be scheduled
205 // when the current write finishes. |fin| and |op_code| are defined as for 212 // when the current write finishes. |fin| and |op_code| are defined as for
206 // SendFrame() above, except that |op_code| may also be a control frame 213 // SendFrame() above, except that |op_code| may also be a control frame
207 // opcode. 214 // opcode.
208 ChannelState SendIOBuffer(bool fin, 215 ChannelState SendIOBuffer(bool fin,
209 WebSocketFrameHeader::OpCode op_code, 216 WebSocketFrameHeader::OpCode op_code,
210 const scoped_refptr<IOBuffer>& buffer, 217 const scoped_refptr<IOBuffer>& buffer,
211 size_t size) WARN_UNUSED_RESULT; 218 size_t size) WARN_UNUSED_RESULT;
212 219
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 scoped_ptr<HandshakeNotificationSender> notification_sender_; 319 scoped_ptr<HandshakeNotificationSender> notification_sender_;
313 320
314 // UTF-8 validator for outgoing Text messages. 321 // UTF-8 validator for outgoing Text messages.
315 base::StreamingUtf8Validator outgoing_utf8_validator_; 322 base::StreamingUtf8Validator outgoing_utf8_validator_;
316 bool sending_text_message_; 323 bool sending_text_message_;
317 324
318 // UTF-8 validator for incoming Text messages. 325 // UTF-8 validator for incoming Text messages.
319 base::StreamingUtf8Validator incoming_utf8_validator_; 326 base::StreamingUtf8Validator incoming_utf8_validator_;
320 bool receiving_text_message_; 327 bool receiving_text_message_;
321 328
329 // True if we are in the middle of receiving a message.
330 bool expecting_to_read_continuation_;
331
322 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); 332 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel);
323 }; 333 };
324 334
325 } // namespace net 335 } // namespace net
326 336
327 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ 337 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | net/websockets/websocket_channel.cc » ('j') | net/websockets/websocket_channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698