| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // WebSocketHandshake*Handler handles WebSocket handshake request message | 5 // WebSocketHandshake*Handler handles WebSocket handshake request message |
| 6 // from WebKit renderer process, and WebSocket handshake response message | 6 // from WebKit renderer process, and WebSocket handshake response message |
| 7 // from WebSocket server. | 7 // from WebSocket server. |
| 8 // It modifies messages for the following reason: | 8 // It modifies messages for the following reason: |
| 9 // - We don't trust WebKit renderer process, so we'll not expose HttpOnly | 9 // - We don't trust WebKit renderer process, so we'll not expose HttpOnly |
| 10 // cookies to the renderer process, so handles HttpOnly cookies in | 10 // cookies to the renderer process, so handles HttpOnly cookies in |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // drop codes handling old-style handshake. | 26 // drop codes handling old-style handshake. |
| 27 | 27 |
| 28 #ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ | 28 #ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ |
| 29 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ | 29 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ |
| 30 #pragma once | 30 #pragma once |
| 31 | 31 |
| 32 #include <string> | 32 #include <string> |
| 33 #include <vector> | 33 #include <vector> |
| 34 | 34 |
| 35 #include "base/memory/ref_counted.h" | 35 #include "base/memory/ref_counted.h" |
| 36 #include "net/base/net_api.h" | 36 #include "net/base/net_export.h" |
| 37 #include "net/http/http_request_info.h" | 37 #include "net/http/http_request_info.h" |
| 38 #include "net/http/http_response_info.h" | 38 #include "net/http/http_response_info.h" |
| 39 #include "net/spdy/spdy_framer.h" | 39 #include "net/spdy/spdy_framer.h" |
| 40 | 40 |
| 41 namespace net { | 41 namespace net { |
| 42 | 42 |
| 43 class NET_TEST WebSocketHandshakeRequestHandler { | 43 class NET_EXPORT_PRIVATE WebSocketHandshakeRequestHandler { |
| 44 public: | 44 public: |
| 45 WebSocketHandshakeRequestHandler(); | 45 WebSocketHandshakeRequestHandler(); |
| 46 ~WebSocketHandshakeRequestHandler() {} | 46 ~WebSocketHandshakeRequestHandler() {} |
| 47 | 47 |
| 48 // Parses WebSocket handshake request from renderer process. | 48 // Parses WebSocket handshake request from renderer process. |
| 49 // It assumes a WebSocket handshake request message is given at once, and | 49 // It assumes a WebSocket handshake request message is given at once, and |
| 50 // no other data is added to the request message. | 50 // no other data is added to the request message. |
| 51 bool ParseRequest(const char* data, int length); | 51 bool ParseRequest(const char* data, int length); |
| 52 | 52 |
| 53 size_t original_length() const; | 53 size_t original_length() const; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 std::string status_line_; | 86 std::string status_line_; |
| 87 std::string headers_; | 87 std::string headers_; |
| 88 std::string key3_; | 88 std::string key3_; |
| 89 int original_length_; | 89 int original_length_; |
| 90 int raw_length_; | 90 int raw_length_; |
| 91 int protocol_version_; // "-1" means we haven't parsed the handshake yet. | 91 int protocol_version_; // "-1" means we haven't parsed the handshake yet. |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeRequestHandler); | 93 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeRequestHandler); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 class NET_TEST WebSocketHandshakeResponseHandler { | 96 class NET_EXPORT_PRIVATE WebSocketHandshakeResponseHandler { |
| 97 public: | 97 public: |
| 98 WebSocketHandshakeResponseHandler(); | 98 WebSocketHandshakeResponseHandler(); |
| 99 ~WebSocketHandshakeResponseHandler(); | 99 ~WebSocketHandshakeResponseHandler(); |
| 100 | 100 |
| 101 // Set WebSocket protocol version before parsing the response. | 101 // Set WebSocket protocol version before parsing the response. |
| 102 // Default is 0 (hybi-00, which is same as hixie-76). | 102 // Default is 0 (hybi-00, which is same as hixie-76). |
| 103 int protocol_version() const; | 103 int protocol_version() const; |
| 104 void set_protocol_version(int protocol_version); | 104 void set_protocol_version(int protocol_version); |
| 105 | 105 |
| 106 // Parses WebSocket handshake response from WebSocket server. | 106 // Parses WebSocket handshake response from WebSocket server. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 std::string header_separator_; | 147 std::string header_separator_; |
| 148 std::string key_; | 148 std::string key_; |
| 149 int protocol_version_; | 149 int protocol_version_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeResponseHandler); | 151 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeResponseHandler); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace net | 154 } // namespace net |
| 155 | 155 |
| 156 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ | 156 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ |
| OLD | NEW |