diff options
author | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-10 20:32:25 +0000 |
---|---|---|
committer | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-10 20:32:25 +0000 |
commit | 6b9833ea6a8bec0b8618aac2a617b5c89cc361c8 (patch) | |
tree | 5de32642ce440f479887381a1af2f2a69f6d129d /net/http/http_network_transaction.h | |
parent | 0a7930697932e2a79d52840211d969cdcac75919 (diff) | |
download | chromium_src-6b9833ea6a8bec0b8618aac2a617b5c89cc361c8.zip chromium_src-6b9833ea6a8bec0b8618aac2a617b5c89cc361c8.tar.gz chromium_src-6b9833ea6a8bec0b8618aac2a617b5c89cc361c8.tar.bz2 |
Refactor the SSL tunnel establishment code so that it
reuses the four states of writing the request headers
and reading the response headers.
Add a boolean member is_connect_method_ to tell, while
we're in one of those four states, whether we're doing
the HTTP CONNECT method (to set up a tunnel) or the
real transaction.
The motivation of this refactoring is that I need to
read the response body when the CONNECT request fails,
which makes me realize I'd need to duplicate more code
with the original design.
R=darin
BUG=b/1272555
Review URL: http://codereview.chromium.org/1875
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_network_transaction.h')
-rw-r--r-- | net/http/http_network_transaction.h | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index 5386196..0333222 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -63,10 +63,6 @@ class HttpNetworkTransaction : public HttpTransaction { int DoResolveHostComplete(int result); int DoConnect(); int DoConnectComplete(int result); - int DoWriteTunnelRequest(); - int DoWriteTunnelRequestComplete(int result); - int DoReadTunnelResponse(); - int DoReadTunnelResponseComplete(int result); int DoSSLConnectOverTunnel(); int DoSSLConnectOverTunnelComplete(int result); int DoWriteHeaders(); @@ -78,15 +74,6 @@ class HttpNetworkTransaction : public HttpTransaction { int DoReadBody(); int DoReadBodyComplete(int result); - // Called to write the request headers in request_headers_. - int WriteRequestHeaders(); - - // Called to read the response headers into header_buf_. - int ReadResponseHeaders(); - - // Called when header_buf_ contains the complete CONNECT response. - int DidReadTunnelResponse(); - // Called when header_buf_ contains the complete response headers. int DidReadResponseHeaders(); @@ -117,6 +104,13 @@ class HttpNetworkTransaction : public HttpTransaction { bool using_proxy_; // True if using a proxy for HTTP (not HTTPS) bool using_tunnel_; // True if using a tunnel for HTTPS + // True while establishing a tunnel. This allows the HTTP CONNECT + // request/response to reuse the STATE_WRITE_HEADERS, + // STATE_WRITE_HEADERS_COMPLETE, STATE_READ_HEADERS, and + // STATE_READ_HEADERS_COMPLETE states and allows us to tell them apart from + // the real request/response of the transaction. + bool establishing_tunnel_; + std::string request_headers_; size_t request_headers_bytes_sent_; scoped_ptr<UploadDataStream> request_body_stream_; @@ -154,10 +148,6 @@ class HttpNetworkTransaction : public HttpTransaction { STATE_RESOLVE_HOST_COMPLETE, STATE_CONNECT, STATE_CONNECT_COMPLETE, - STATE_WRITE_TUNNEL_REQUEST, - STATE_WRITE_TUNNEL_REQUEST_COMPLETE, - STATE_READ_TUNNEL_RESPONSE, - STATE_READ_TUNNEL_RESPONSE_COMPLETE, STATE_SSL_CONNECT_OVER_TUNNEL, STATE_SSL_CONNECT_OVER_TUNNEL_COMPLETE, STATE_WRITE_HEADERS, |