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

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

Issue 105833003: Fail WebSocket channel when handshake fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
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_BASIC_HANDSHAKE_STREAM_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // have been received. It creates an appropriate subclass of WebSocketStream 65 // have been received. It creates an appropriate subclass of WebSocketStream
66 // depending on what extensions were negotiated. This object is unusable after 66 // depending on what extensions were negotiated. This object is unusable after
67 // Upgrade() has been called and should be disposed of as soon as possible. 67 // Upgrade() has been called and should be disposed of as soon as possible.
68 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE; 68 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE;
69 69
70 // Set the value used for the next Sec-WebSocket-Key header 70 // Set the value used for the next Sec-WebSocket-Key header
71 // deterministically. The key is only used once, and then discarded. 71 // deterministically. The key is only used once, and then discarded.
72 // For tests only. 72 // For tests only.
73 void SetWebSocketKeyForTesting(const std::string& key); 73 void SetWebSocketKeyForTesting(const std::string& key);
74 74
75 virtual std::string GetFailureMessage() const OVERRIDE;
76
75 private: 77 private:
76 // A wrapper for the ReadResponseHeaders callback that checks whether or not 78 // A wrapper for the ReadResponseHeaders callback that checks whether or not
77 // the connection has been accepted. 79 // the connection has been accepted.
78 void ReadResponseHeadersCallback(const CompletionCallback& callback, 80 void ReadResponseHeadersCallback(const CompletionCallback& callback,
79 int result); 81 int result);
80 82
81 // Validates the response from the server and returns OK or 83 // Validates the response from the server and returns OK or
82 // ERR_INVALID_RESPONSE. 84 // ERR_INVALID_RESPONSE.
83 int ValidateResponse(); 85 int ValidateResponse();
84 86
(...skipping 22 matching lines...) Expand all
107 109
108 // The extensions we requested. 110 // The extensions we requested.
109 std::vector<std::string> requested_extensions_; 111 std::vector<std::string> requested_extensions_;
110 112
111 // The sub-protocol selected by the server. 113 // The sub-protocol selected by the server.
112 std::string sub_protocol_; 114 std::string sub_protocol_;
113 115
114 // The extension(s) selected by the server. 116 // The extension(s) selected by the server.
115 std::string extensions_; 117 std::string extensions_;
116 118
119 std::string failure_message_;
120
117 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); 121 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream);
118 }; 122 };
119 123
120 } // namespace net 124 } // namespace net
121 125
122 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ 126 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job_unittest.cc ('k') | net/websockets/websocket_basic_handshake_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698