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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 #include "net/websockets/websocket_handshake_stream_base.h" |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class ClientSocketHandle; | 28 class ClientSocketHandle; |
29 class HttpAuthController; | 29 class HttpAuthController; |
30 class HttpNetworkSession; | 30 class HttpNetworkSession; |
31 class HttpStreamBase; | 31 class HttpStream; |
32 class HttpStreamRequest; | 32 class HttpStreamRequest; |
33 class IOBuffer; | 33 class IOBuffer; |
34 class ProxyInfo; | 34 class ProxyInfo; |
35 class SpdySession; | 35 class SpdySession; |
36 struct HttpRequestInfo; | 36 struct HttpRequestInfo; |
37 | 37 |
38 class NET_EXPORT_PRIVATE HttpNetworkTransaction | 38 class NET_EXPORT_PRIVATE HttpNetworkTransaction |
39 : public HttpTransaction, | 39 : public HttpTransaction, |
40 public HttpStreamRequest::Delegate { | 40 public HttpStreamRequest::Delegate { |
41 public: | 41 public: |
(...skipping 30 matching lines...) Expand all Loading... |
72 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 72 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
73 void SetBeforeNetworkStartCallback( | 73 void SetBeforeNetworkStartCallback( |
74 const BeforeNetworkStartCallback& callback) override; | 74 const BeforeNetworkStartCallback& callback) override; |
75 void SetBeforeProxyHeadersSentCallback( | 75 void SetBeforeProxyHeadersSentCallback( |
76 const BeforeProxyHeadersSentCallback& callback) override; | 76 const BeforeProxyHeadersSentCallback& callback) override; |
77 int ResumeNetworkStart() override; | 77 int ResumeNetworkStart() override; |
78 | 78 |
79 // HttpStreamRequest::Delegate methods: | 79 // HttpStreamRequest::Delegate methods: |
80 void OnStreamReady(const SSLConfig& used_ssl_config, | 80 void OnStreamReady(const SSLConfig& used_ssl_config, |
81 const ProxyInfo& used_proxy_info, | 81 const ProxyInfo& used_proxy_info, |
82 HttpStreamBase* stream) override; | 82 HttpStream* stream) override; |
83 void OnWebSocketHandshakeStreamReady( | 83 void OnWebSocketHandshakeStreamReady( |
84 const SSLConfig& used_ssl_config, | 84 const SSLConfig& used_ssl_config, |
85 const ProxyInfo& used_proxy_info, | 85 const ProxyInfo& used_proxy_info, |
86 WebSocketHandshakeStreamBase* stream) override; | 86 WebSocketHandshakeStreamBase* stream) override; |
87 void OnStreamFailed(int status, const SSLConfig& used_ssl_config) override; | 87 void OnStreamFailed(int status, const SSLConfig& used_ssl_config) override; |
88 void OnCertificateError(int status, | 88 void OnCertificateError(int status, |
89 const SSLConfig& used_ssl_config, | 89 const SSLConfig& used_ssl_config, |
90 const SSLInfo& ssl_info) override; | 90 const SSLInfo& ssl_info) override; |
91 void OnNeedsProxyAuth(const HttpResponseInfo& response_info, | 91 void OnNeedsProxyAuth(const HttpResponseInfo& response_info, |
92 const SSLConfig& used_ssl_config, | 92 const SSLConfig& used_ssl_config, |
93 const ProxyInfo& used_proxy_info, | 93 const ProxyInfo& used_proxy_info, |
94 HttpAuthController* auth_controller) override; | 94 HttpAuthController* auth_controller) override; |
95 void OnNeedsClientAuth(const SSLConfig& used_ssl_config, | 95 void OnNeedsClientAuth(const SSLConfig& used_ssl_config, |
96 SSLCertRequestInfo* cert_info) override; | 96 SSLCertRequestInfo* cert_info) override; |
97 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, | 97 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, |
98 const SSLConfig& used_ssl_config, | 98 const SSLConfig& used_ssl_config, |
99 const ProxyInfo& used_proxy_info, | 99 const ProxyInfo& used_proxy_info, |
100 HttpStreamBase* stream) override; | 100 HttpStream* stream) override; |
101 | 101 |
102 private: | 102 private: |
103 friend class HttpNetworkTransactionSSLTest; | 103 friend class HttpNetworkTransactionSSLTest; |
104 | 104 |
105 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, | 105 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, |
106 ResetStateForRestart); | 106 ResetStateForRestart); |
107 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 107 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
108 WindowUpdateReceived); | 108 WindowUpdateReceived); |
109 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 109 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
110 WindowUpdateSent); | 110 WindowUpdateSent); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 // Get the {scheme, host, path, port} for the authentication target | 241 // Get the {scheme, host, path, port} for the authentication target |
242 GURL AuthURL(HttpAuth::Target target) const; | 242 GURL AuthURL(HttpAuth::Target target) const; |
243 | 243 |
244 // Returns true if this transaction is for a WebSocket handshake | 244 // Returns true if this transaction is for a WebSocket handshake |
245 bool ForWebSocketHandshake() const; | 245 bool ForWebSocketHandshake() const; |
246 | 246 |
247 // Debug helper. | 247 // Debug helper. |
248 static std::string DescribeState(State state); | 248 static std::string DescribeState(State state); |
249 | 249 |
250 void SetStream(HttpStreamBase* stream); | 250 void SetStream(HttpStream* stream); |
251 | 251 |
252 scoped_refptr<HttpAuthController> | 252 scoped_refptr<HttpAuthController> |
253 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; | 253 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; |
254 | 254 |
255 // Whether this transaction is waiting for proxy auth, server auth, or is | 255 // Whether this transaction is waiting for proxy auth, server auth, or is |
256 // not waiting for any auth at all. |pending_auth_target_| is read and | 256 // not waiting for any auth at all. |pending_auth_target_| is read and |
257 // cleared by RestartWithAuth(). | 257 // cleared by RestartWithAuth(). |
258 HttpAuth::Target pending_auth_target_; | 258 HttpAuth::Target pending_auth_target_; |
259 | 259 |
260 CompletionCallback io_callback_; | 260 CompletionCallback io_callback_; |
261 CompletionCallback callback_; | 261 CompletionCallback callback_; |
262 | 262 |
263 HttpNetworkSession* session_; | 263 HttpNetworkSession* session_; |
264 | 264 |
265 BoundNetLog net_log_; | 265 BoundNetLog net_log_; |
266 const HttpRequestInfo* request_; | 266 const HttpRequestInfo* request_; |
267 RequestPriority priority_; | 267 RequestPriority priority_; |
268 HttpResponseInfo response_; | 268 HttpResponseInfo response_; |
269 | 269 |
270 // |proxy_info_| is the ProxyInfo used by the HttpStreamRequest. | 270 // |proxy_info_| is the ProxyInfo used by the HttpStreamRequest. |
271 ProxyInfo proxy_info_; | 271 ProxyInfo proxy_info_; |
272 | 272 |
273 scoped_ptr<HttpStreamRequest> stream_request_; | 273 scoped_ptr<HttpStreamRequest> stream_request_; |
274 scoped_ptr<HttpStreamBase> stream_; | 274 scoped_ptr<HttpStream> stream_; |
275 | 275 |
276 // True if we've validated the headers that the stream parser has returned. | 276 // True if we've validated the headers that the stream parser has returned. |
277 bool headers_valid_; | 277 bool headers_valid_; |
278 | 278 |
279 SSLConfig server_ssl_config_; | 279 SSLConfig server_ssl_config_; |
280 SSLConfig proxy_ssl_config_; | 280 SSLConfig proxy_ssl_config_; |
281 // fallback_error_code contains the error code that caused the last TLS | 281 // fallback_error_code contains the error code that caused the last TLS |
282 // fallback. If the fallback connection results in | 282 // fallback. If the fallback connection results in |
283 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the | 283 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the |
284 // fallback should not have been needed) then we use this value to return the | 284 // fallback should not have been needed) then we use this value to return the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 BeforeNetworkStartCallback before_network_start_callback_; | 319 BeforeNetworkStartCallback before_network_start_callback_; |
320 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 320 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
321 | 321 |
322 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 322 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
323 }; | 323 }; |
324 | 324 |
325 } // namespace net | 325 } // namespace net |
326 | 326 |
327 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 327 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |