| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual std::string GetFailureMessage() const OVERRIDE; | 79 virtual std::string GetFailureMessage() const OVERRIDE; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 // A wrapper for the ReadResponseHeaders callback that checks whether or not | 82 // A wrapper for the ReadResponseHeaders callback that checks whether or not |
| 83 // the connection has been accepted. | 83 // the connection has been accepted. |
| 84 void ReadResponseHeadersCallback(const CompletionCallback& callback, | 84 void ReadResponseHeadersCallback(const CompletionCallback& callback, |
| 85 int result); | 85 int result); |
| 86 | 86 |
| 87 void OnFinishOpeningHandshake(); | 87 void OnFinishOpeningHandshake(); |
| 88 | 88 |
| 89 // Validates the response from the server and returns OK or | 89 // Validates the response and sends the finished handshake event. |
| 90 // ERR_INVALID_RESPONSE. | 90 int ValidateResponse(int rv); |
| 91 int ValidateResponse(); | |
| 92 | 91 |
| 93 // Check that the headers are well-formed for a 101 response, and returns | 92 // Check that the headers are well-formed for a 101 response, and returns |
| 94 // OK if they are, otherwise returns ERR_INVALID_RESPONSE. | 93 // OK if they are, otherwise returns ERR_INVALID_RESPONSE. |
| 95 int ValidateUpgradeResponse( | 94 int ValidateUpgradeResponse(const HttpResponseHeaders* headers); |
| 96 const scoped_refptr<HttpResponseHeaders>& headers); | |
| 97 | 95 |
| 98 HttpStreamParser* parser() const { return state_.parser(); } | 96 HttpStreamParser* parser() const { return state_.parser(); } |
| 99 | 97 |
| 100 // The request URL. | 98 // The request URL. |
| 101 GURL url_; | 99 GURL url_; |
| 102 | 100 |
| 103 // HttpBasicState holds most of the handshake-related state. | 101 // HttpBasicState holds most of the handshake-related state. |
| 104 HttpBasicState state_; | 102 HttpBasicState state_; |
| 105 | 103 |
| 106 // Owned by another object. | 104 // Owned by another object. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 134 scoped_ptr<WebSocketExtensionParams> extension_params_; | 132 scoped_ptr<WebSocketExtensionParams> extension_params_; |
| 135 | 133 |
| 136 std::string failure_message_; | 134 std::string failure_message_; |
| 137 | 135 |
| 138 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); | 136 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); |
| 139 }; | 137 }; |
| 140 | 138 |
| 141 } // namespace net | 139 } // namespace net |
| 142 | 140 |
| 143 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ | 141 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ |
| OLD | NEW |