OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
15 #include "net/base/host_resolver.h" | 15 #include "net/base/host_resolver.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
| 19 #include "net/base/net_log.h" |
19 #include "net/base/ssl_config_service.h" | 20 #include "net/base/ssl_config_service.h" |
20 #include "net/http/http_alternate_protocols.h" | 21 #include "net/http/http_alternate_protocols.h" |
21 #include "net/http/http_auth.h" | 22 #include "net/http/http_auth.h" |
22 #include "net/http/http_auth_handler.h" | 23 #include "net/http/http_auth_handler.h" |
23 #include "net/http/http_response_info.h" | 24 #include "net/http/http_response_info.h" |
24 #include "net/http/http_transaction.h" | 25 #include "net/http/http_transaction.h" |
25 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
26 #include "net/socket/client_socket_pool.h" | 27 #include "net/socket/client_socket_pool.h" |
27 #include "testing/gtest/include/gtest/gtest_prod.h" | 28 #include "testing/gtest/include/gtest/gtest_prod.h" |
28 | 29 |
(...skipping 14 matching lines...) Expand all Loading... |
43 // Sets the next protocol negotiation value used during the SSL handshake. | 44 // Sets the next protocol negotiation value used during the SSL handshake. |
44 static void SetNextProtos(const std::string& next_protos); | 45 static void SetNextProtos(const std::string& next_protos); |
45 | 46 |
46 // Sets the HttpNetworkTransaction into a mode where it can ignore | 47 // Sets the HttpNetworkTransaction into a mode where it can ignore |
47 // certificate errors. This is for testing. | 48 // certificate errors. This is for testing. |
48 static void IgnoreCertificateErrors(bool enabled); | 49 static void IgnoreCertificateErrors(bool enabled); |
49 | 50 |
50 // HttpTransaction methods: | 51 // HttpTransaction methods: |
51 virtual int Start(const HttpRequestInfo* request_info, | 52 virtual int Start(const HttpRequestInfo* request_info, |
52 CompletionCallback* callback, | 53 CompletionCallback* callback, |
53 LoadLog* load_log); | 54 const BoundNetLog& net_log); |
54 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 55 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
55 virtual int RestartWithCertificate(X509Certificate* client_cert, | 56 virtual int RestartWithCertificate(X509Certificate* client_cert, |
56 CompletionCallback* callback); | 57 CompletionCallback* callback); |
57 virtual int RestartWithAuth(const std::wstring& username, | 58 virtual int RestartWithAuth(const std::wstring& username, |
58 const std::wstring& password, | 59 const std::wstring& password, |
59 CompletionCallback* callback); | 60 CompletionCallback* callback); |
60 virtual bool IsReadyToRestartForAuth() { | 61 virtual bool IsReadyToRestartForAuth() { |
61 return pending_auth_target_ != HttpAuth::AUTH_NONE && | 62 return pending_auth_target_ != HttpAuth::AUTH_NONE && |
62 HaveAuth(pending_auth_target_); | 63 HaveAuth(pending_auth_target_); |
63 } | 64 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // Whether this transaction is waiting for proxy auth, server auth, or is | 289 // Whether this transaction is waiting for proxy auth, server auth, or is |
289 // not waiting for any auth at all. |pending_auth_target_| is read and | 290 // not waiting for any auth at all. |pending_auth_target_| is read and |
290 // cleared by RestartWithAuth(). | 291 // cleared by RestartWithAuth(). |
291 HttpAuth::Target pending_auth_target_; | 292 HttpAuth::Target pending_auth_target_; |
292 | 293 |
293 CompletionCallbackImpl<HttpNetworkTransaction> io_callback_; | 294 CompletionCallbackImpl<HttpNetworkTransaction> io_callback_; |
294 CompletionCallback* user_callback_; | 295 CompletionCallback* user_callback_; |
295 | 296 |
296 scoped_refptr<HttpNetworkSession> session_; | 297 scoped_refptr<HttpNetworkSession> session_; |
297 | 298 |
298 scoped_refptr<LoadLog> load_log_; | 299 BoundNetLog net_log_; |
299 const HttpRequestInfo* request_; | 300 const HttpRequestInfo* request_; |
300 HttpResponseInfo response_; | 301 HttpResponseInfo response_; |
301 | 302 |
302 ProxyService::PacRequest* pac_request_; | 303 ProxyService::PacRequest* pac_request_; |
303 ProxyInfo proxy_info_; | 304 ProxyInfo proxy_info_; |
304 | 305 |
305 scoped_ptr<ClientSocketHandle> connection_; | 306 scoped_ptr<ClientSocketHandle> connection_; |
306 scoped_ptr<HttpStream> http_stream_; | 307 scoped_ptr<HttpStream> http_stream_; |
307 scoped_refptr<SpdyStream> spdy_stream_; | 308 scoped_refptr<SpdyStream> spdy_stream_; |
308 bool reused_socket_; | 309 bool reused_socket_; |
(...skipping 13 matching lines...) Expand all Loading... |
322 // request/response to reuse the STATE_SEND_REQUEST, | 323 // request/response to reuse the STATE_SEND_REQUEST, |
323 // STATE_SEND_REQUEST_COMPLETE, STATE_READ_HEADERS, and | 324 // STATE_SEND_REQUEST_COMPLETE, STATE_READ_HEADERS, and |
324 // STATE_READ_HEADERS_COMPLETE states and allows us to tell them apart from | 325 // STATE_READ_HEADERS_COMPLETE states and allows us to tell them apart from |
325 // the real request/response of the transaction. | 326 // the real request/response of the transaction. |
326 bool establishing_tunnel_; | 327 bool establishing_tunnel_; |
327 | 328 |
328 // True if this network transaction is using SPDY instead of HTTP. | 329 // True if this network transaction is using SPDY instead of HTTP. |
329 bool using_spdy_; | 330 bool using_spdy_; |
330 | 331 |
331 AlternateProtocolMode alternate_protocol_mode_; | 332 AlternateProtocolMode alternate_protocol_mode_; |
332 | 333 |
333 // Only valid if |alternate_protocol_mode_| == kUsingAlternateProtocol. | 334 // Only valid if |alternate_protocol_mode_| == kUsingAlternateProtocol. |
334 HttpAlternateProtocols::Protocol alternate_protocol_; | 335 HttpAlternateProtocols::Protocol alternate_protocol_; |
335 | 336 |
336 // True if we've used the username/password embedded in the URL. This | 337 // True if we've used the username/password embedded in the URL. This |
337 // makes sure we use the embedded identity only once for the transaction, | 338 // makes sure we use the embedded identity only once for the transaction, |
338 // preventing an infinite auth restart loop. | 339 // preventing an infinite auth restart loop. |
339 bool embedded_identity_used_; | 340 bool embedded_identity_used_; |
340 | 341 |
341 SSLConfig ssl_config_; | 342 SSLConfig ssl_config_; |
342 | 343 |
(...skipping 14 matching lines...) Expand all Loading... |
357 // The time the DoSSLConnect() method was called (if it got called). | 358 // The time the DoSSLConnect() method was called (if it got called). |
358 base::TimeTicks ssl_connect_start_time_; | 359 base::TimeTicks ssl_connect_start_time_; |
359 | 360 |
360 // The next state in the state machine. | 361 // The next state in the state machine. |
361 State next_state_; | 362 State next_state_; |
362 }; | 363 }; |
363 | 364 |
364 } // namespace net | 365 } // namespace net |
365 | 366 |
366 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 367 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |