OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
16 #include "net/base/request_priority.h" | 16 #include "net/base/request_priority.h" |
17 #include "net/http/http_auth.h" | 17 #include "net/http/http_auth.h" |
18 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
19 #include "net/http/http_response_info.h" | 19 #include "net/http/http_response_info.h" |
20 #include "net/http/http_stream_factory.h" | 20 #include "net/http/http_stream_factory.h" |
21 #include "net/http/http_transaction.h" | 21 #include "net/http/http_transaction.h" |
22 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
23 #include "net/ssl/ssl_config_service.h" | 23 #include "net/ssl/ssl_config_service.h" |
| 24 #include "net/websockets/websocket_handshake_stream_base.h" |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 | 27 |
27 class ClientSocketHandle; | 28 class ClientSocketHandle; |
28 class HttpAuthController; | 29 class HttpAuthController; |
29 class HttpNetworkSession; | 30 class HttpNetworkSession; |
30 class HttpStreamBase; | 31 class HttpStreamBase; |
31 class HttpStreamRequest; | 32 class HttpStreamRequest; |
32 class IOBuffer; | 33 class IOBuffer; |
33 class SpdySession; | 34 class SpdySession; |
(...skipping 27 matching lines...) Expand all Loading... |
61 virtual void StopCaching() OVERRIDE {} | 62 virtual void StopCaching() OVERRIDE {} |
62 virtual bool GetFullRequestHeaders( | 63 virtual bool GetFullRequestHeaders( |
63 HttpRequestHeaders* headers) const OVERRIDE; | 64 HttpRequestHeaders* headers) const OVERRIDE; |
64 virtual void DoneReading() OVERRIDE {} | 65 virtual void DoneReading() OVERRIDE {} |
65 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; | 66 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; |
66 virtual LoadState GetLoadState() const OVERRIDE; | 67 virtual LoadState GetLoadState() const OVERRIDE; |
67 virtual UploadProgress GetUploadProgress() const OVERRIDE; | 68 virtual UploadProgress GetUploadProgress() const OVERRIDE; |
68 virtual bool GetLoadTimingInfo( | 69 virtual bool GetLoadTimingInfo( |
69 LoadTimingInfo* load_timing_info) const OVERRIDE; | 70 LoadTimingInfo* load_timing_info) const OVERRIDE; |
70 virtual void SetPriority(RequestPriority priority) OVERRIDE; | 71 virtual void SetPriority(RequestPriority priority) OVERRIDE; |
| 72 virtual void SetWebSocketHandshakeStreamFactory( |
| 73 WebSocketHandshakeStreamBase::Factory* factory) OVERRIDE; |
71 | 74 |
72 // HttpStreamRequest::Delegate methods: | 75 // HttpStreamRequest::Delegate methods: |
73 virtual void OnStreamReady(const SSLConfig& used_ssl_config, | 76 virtual void OnStreamReady(const SSLConfig& used_ssl_config, |
74 const ProxyInfo& used_proxy_info, | 77 const ProxyInfo& used_proxy_info, |
75 HttpStreamBase* stream) OVERRIDE; | 78 HttpStreamBase* stream) OVERRIDE; |
76 virtual void OnWebSocketHandshakeStreamReady( | 79 virtual void OnWebSocketHandshakeStreamReady( |
77 const SSLConfig& used_ssl_config, | 80 const SSLConfig& used_ssl_config, |
78 const ProxyInfo& used_proxy_info, | 81 const ProxyInfo& used_proxy_info, |
79 WebSocketHandshakeStreamBase* stream) OVERRIDE; | 82 WebSocketHandshakeStreamBase* stream) OVERRIDE; |
80 virtual void OnStreamFailed(int status, | 83 virtual void OnStreamFailed(int status, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // HandleAuthChallenge() returns a network error code, or OK on success. | 238 // HandleAuthChallenge() returns a network error code, or OK on success. |
236 // May update |pending_auth_target_| or |response_.auth_challenge|. | 239 // May update |pending_auth_target_| or |response_.auth_challenge|. |
237 int HandleAuthChallenge(); | 240 int HandleAuthChallenge(); |
238 | 241 |
239 // Returns true if we have auth credentials for the given target. | 242 // Returns true if we have auth credentials for the given target. |
240 bool HaveAuth(HttpAuth::Target target) const; | 243 bool HaveAuth(HttpAuth::Target target) const; |
241 | 244 |
242 // Get the {scheme, host, path, port} for the authentication target | 245 // Get the {scheme, host, path, port} for the authentication target |
243 GURL AuthURL(HttpAuth::Target target) const; | 246 GURL AuthURL(HttpAuth::Target target) const; |
244 | 247 |
| 248 // Returns true if this transaction is for a WebSocket handshake |
| 249 bool ForWebSocketHandshake() const; |
| 250 |
245 // Debug helper. | 251 // Debug helper. |
246 static std::string DescribeState(State state); | 252 static std::string DescribeState(State state); |
247 | 253 |
248 scoped_refptr<HttpAuthController> | 254 scoped_refptr<HttpAuthController> |
249 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; | 255 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; |
250 | 256 |
251 // Whether this transaction is waiting for proxy auth, server auth, or is | 257 // Whether this transaction is waiting for proxy auth, server auth, or is |
252 // not waiting for any auth at all. |pending_auth_target_| is read and | 258 // not waiting for any auth at all. |pending_auth_target_| is read and |
253 // cleared by RestartWithAuth(). | 259 // cleared by RestartWithAuth(). |
254 HttpAuth::Target pending_auth_target_; | 260 HttpAuth::Target pending_auth_target_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 base::TimeTicks send_start_time_; | 305 base::TimeTicks send_start_time_; |
300 base::TimeTicks send_end_time_; | 306 base::TimeTicks send_end_time_; |
301 | 307 |
302 // The next state in the state machine. | 308 // The next state in the state machine. |
303 State next_state_; | 309 State next_state_; |
304 | 310 |
305 // True when the tunnel is in the process of being established - we can't | 311 // True when the tunnel is in the process of being established - we can't |
306 // read from the socket until the tunnel is done. | 312 // read from the socket until the tunnel is done. |
307 bool establishing_tunnel_; | 313 bool establishing_tunnel_; |
308 | 314 |
| 315 // The factory to use to create WebSocketHandshakeStreamBase objects. Only |
| 316 // relevant when establishing a WebSocket connection. |
| 317 WebSocketHandshakeStreamBase::Factory* |
| 318 websocket_handshake_stream_base_factory_; |
| 319 |
309 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 320 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
310 }; | 321 }; |
311 | 322 |
312 } // namespace net | 323 } // namespace net |
313 | 324 |
314 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 325 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |