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

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 7 years 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // have been received. It creates an appropriate subclass of WebSocketStream 64 // have been received. It creates an appropriate subclass of WebSocketStream
65 // depending on what extensions were negotiated. This object is unusable after 65 // depending on what extensions were negotiated. This object is unusable after
66 // Upgrade() has been called and should be disposed of as soon as possible. 66 // Upgrade() has been called and should be disposed of as soon as possible.
67 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE; 67 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE;
68 68
69 // Set the value used for the next Sec-WebSocket-Key header 69 // Set the value used for the next Sec-WebSocket-Key header
70 // deterministically. The key is only used once, and then discarded. 70 // deterministically. The key is only used once, and then discarded.
71 // For tests only. 71 // For tests only.
72 void SetWebSocketKeyForTesting(const std::string& key); 72 void SetWebSocketKeyForTesting(const std::string& key);
73 73
74 virtual std::string GetFailureMessage() const OVERRIDE;
75
74 private: 76 private:
75 // A wrapper for the ReadResponseHeaders callback that checks whether or not 77 // A wrapper for the ReadResponseHeaders callback that checks whether or not
76 // the connection has been accepted. 78 // the connection has been accepted.
77 void ReadResponseHeadersCallback(const CompletionCallback& callback, 79 void ReadResponseHeadersCallback(const CompletionCallback& callback,
78 int result); 80 int result);
79 81
80 // Validates the response from the server and returns OK or 82 // Validates the response from the server and returns OK or
81 // ERR_INVALID_RESPONSE. 83 // ERR_INVALID_RESPONSE.
82 int ValidateResponse(); 84 int ValidateResponse();
83 85
(...skipping 22 matching lines...) Expand all
106 108
107 // The extensions we requested. 109 // The extensions we requested.
108 std::vector<std::string> requested_extensions_; 110 std::vector<std::string> requested_extensions_;
109 111
110 // The sub-protocol selected by the server. 112 // The sub-protocol selected by the server.
111 std::string sub_protocol_; 113 std::string sub_protocol_;
112 114
113 // The extension(s) selected by the server. 115 // The extension(s) selected by the server.
114 std::string extensions_; 116 std::string extensions_;
115 117
118 std::string failure_message_;
119
116 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); 120 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream);
117 }; 121 };
118 122
119 } // namespace net 123 } // namespace net
120 124
121 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ 125 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698