| 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/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 scoped_ptr_malloc<char> headers_; | 94 scoped_ptr_malloc<char> headers_; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 enum State { | 97 enum State { |
| 98 STATE_RESOLVE_PROXY, | 98 STATE_RESOLVE_PROXY, |
| 99 STATE_RESOLVE_PROXY_COMPLETE, | 99 STATE_RESOLVE_PROXY_COMPLETE, |
| 100 STATE_INIT_CONNECTION, | 100 STATE_INIT_CONNECTION, |
| 101 STATE_INIT_CONNECTION_COMPLETE, | 101 STATE_INIT_CONNECTION_COMPLETE, |
| 102 STATE_SOCKS_CONNECT, |
| 103 STATE_SOCKS_CONNECT_COMPLETE, |
| 102 STATE_SSL_CONNECT, | 104 STATE_SSL_CONNECT, |
| 103 STATE_SSL_CONNECT_COMPLETE, | 105 STATE_SSL_CONNECT_COMPLETE, |
| 104 STATE_WRITE_HEADERS, | 106 STATE_WRITE_HEADERS, |
| 105 STATE_WRITE_HEADERS_COMPLETE, | 107 STATE_WRITE_HEADERS_COMPLETE, |
| 106 STATE_WRITE_BODY, | 108 STATE_WRITE_BODY, |
| 107 STATE_WRITE_BODY_COMPLETE, | 109 STATE_WRITE_BODY_COMPLETE, |
| 108 STATE_READ_HEADERS, | 110 STATE_READ_HEADERS, |
| 109 STATE_READ_HEADERS_COMPLETE, | 111 STATE_READ_HEADERS_COMPLETE, |
| 110 STATE_READ_BODY, | 112 STATE_READ_BODY, |
| 111 STATE_READ_BODY_COMPLETE, | 113 STATE_READ_BODY_COMPLETE, |
| 112 STATE_DRAIN_BODY_FOR_AUTH_RESTART, | 114 STATE_DRAIN_BODY_FOR_AUTH_RESTART, |
| 113 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, | 115 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, |
| 114 STATE_NONE | 116 STATE_NONE |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 void DoCallback(int result); | 119 void DoCallback(int result); |
| 118 void OnIOComplete(int result); | 120 void OnIOComplete(int result); |
| 119 | 121 |
| 120 // Runs the state transition loop. | 122 // Runs the state transition loop. |
| 121 int DoLoop(int result); | 123 int DoLoop(int result); |
| 122 | 124 |
| 123 // Each of these methods corresponds to a State value. Those with an input | 125 // Each of these methods corresponds to a State value. Those with an input |
| 124 // argument receive the result from the previous state. If a method returns | 126 // argument receive the result from the previous state. If a method returns |
| 125 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the | 127 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the |
| 126 // next state method as the result arg. | 128 // next state method as the result arg. |
| 127 int DoResolveProxy(); | 129 int DoResolveProxy(); |
| 128 int DoResolveProxyComplete(int result); | 130 int DoResolveProxyComplete(int result); |
| 129 int DoInitConnection(); | 131 int DoInitConnection(); |
| 130 int DoInitConnectionComplete(int result); | 132 int DoInitConnectionComplete(int result); |
| 133 int DoSOCKSConnect(); |
| 134 int DoSOCKSConnectComplete(int result); |
| 131 int DoSSLConnect(); | 135 int DoSSLConnect(); |
| 132 int DoSSLConnectComplete(int result); | 136 int DoSSLConnectComplete(int result); |
| 133 int DoWriteHeaders(); | 137 int DoWriteHeaders(); |
| 134 int DoWriteHeadersComplete(int result); | 138 int DoWriteHeadersComplete(int result); |
| 135 int DoWriteBody(); | 139 int DoWriteBody(); |
| 136 int DoWriteBodyComplete(int result); | 140 int DoWriteBodyComplete(int result); |
| 137 int DoReadHeaders(); | 141 int DoReadHeaders(); |
| 138 int DoReadHeadersComplete(int result); | 142 int DoReadHeadersComplete(int result); |
| 139 int DoReadBody(); | 143 int DoReadBody(); |
| 140 int DoReadBodyComplete(int result); | 144 int DoReadBodyComplete(int result); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 ProxyInfo proxy_info_; | 302 ProxyInfo proxy_info_; |
| 299 | 303 |
| 300 ClientSocketFactory* socket_factory_; | 304 ClientSocketFactory* socket_factory_; |
| 301 ClientSocketHandle connection_; | 305 ClientSocketHandle connection_; |
| 302 scoped_ptr<HttpStream> http_stream_; | 306 scoped_ptr<HttpStream> http_stream_; |
| 303 bool reused_socket_; | 307 bool reused_socket_; |
| 304 | 308 |
| 305 bool using_ssl_; // True if handling a HTTPS request | 309 bool using_ssl_; // True if handling a HTTPS request |
| 306 bool using_proxy_; // True if using a proxy for HTTP (not HTTPS) | 310 bool using_proxy_; // True if using a proxy for HTTP (not HTTPS) |
| 307 bool using_tunnel_; // True if using a tunnel for HTTPS | 311 bool using_tunnel_; // True if using a tunnel for HTTPS |
| 312 bool using_socks_proxy_; // True if using a SOCKS proxy |
| 308 | 313 |
| 309 // True while establishing a tunnel. This allows the HTTP CONNECT | 314 // True while establishing a tunnel. This allows the HTTP CONNECT |
| 310 // request/response to reuse the STATE_WRITE_HEADERS, | 315 // request/response to reuse the STATE_WRITE_HEADERS, |
| 311 // STATE_WRITE_HEADERS_COMPLETE, STATE_READ_HEADERS, and | 316 // STATE_WRITE_HEADERS_COMPLETE, STATE_READ_HEADERS, and |
| 312 // STATE_READ_HEADERS_COMPLETE states and allows us to tell them apart from | 317 // STATE_READ_HEADERS_COMPLETE states and allows us to tell them apart from |
| 313 // the real request/response of the transaction. | 318 // the real request/response of the transaction. |
| 314 bool establishing_tunnel_; | 319 bool establishing_tunnel_; |
| 315 | 320 |
| 316 // Only used between the states | 321 // Only used between the states |
| 317 // STATE_READ_BODY/STATE_DRAIN_BODY_FOR_AUTH and | 322 // STATE_READ_BODY/STATE_DRAIN_BODY_FOR_AUTH and |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // The time the host resolution started (if it indeed got started). | 391 // The time the host resolution started (if it indeed got started). |
| 387 base::Time host_resolution_start_time_; | 392 base::Time host_resolution_start_time_; |
| 388 | 393 |
| 389 // The next state in the state machine. | 394 // The next state in the state machine. |
| 390 State next_state_; | 395 State next_state_; |
| 391 }; | 396 }; |
| 392 | 397 |
| 393 } // namespace net | 398 } // namespace net |
| 394 | 399 |
| 395 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 400 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| OLD | NEW |