| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |