summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 05:35:40 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-28 05:35:40 +0000
commit874190c24578f3b6e41425b7b7d12df4a958c858 (patch)
tree4fe6234850a1c9112ec9547a62ae314cfa68b1c9 /net
parente77558d6c797ec4e75259a65ba886b11a474fc3a (diff)
downloadchromium_src-874190c24578f3b6e41425b7b7d12df4a958c858.zip
chromium_src-874190c24578f3b6e41425b7b7d12df4a958c858.tar.gz
chromium_src-874190c24578f3b6e41425b7b7d12df4a958c858.tar.bz2
Remove proxy_mode_ from the HttpNetworkTransaction since it
is redundant with proxy_info_. BUG=none TEST=covered by existing tests. Review URL: http://codereview.chromium.org/1809001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_transaction.cc28
-rw-r--r--net/http/http_network_transaction.h8
-rw-r--r--net/proxy/proxy_info.h14
3 files changed, 22 insertions, 28 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 544c033..ccb600e 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -222,7 +222,6 @@ HttpNetworkTransaction::HttpNetworkTransaction(HttpNetworkSession* session)
headers_valid_(false),
logged_response_time(false),
using_ssl_(false),
- proxy_mode_(kDirectConnection),
establishing_tunnel_(false),
using_spdy_(false),
alternate_protocol_mode_(
@@ -697,16 +696,6 @@ int HttpNetworkTransaction::DoInitConnection() {
using_ssl_ = request_->url.SchemeIs("https");
using_spdy_ = false;
- // TODO(vandebo) get rid of proxy_mode_, it's redundant
- if (proxy_info_.is_direct())
- proxy_mode_ = kDirectConnection;
- else if (proxy_info_.proxy_server().is_socks())
- proxy_mode_ = kSOCKSProxy;
- else if (using_ssl_)
- proxy_mode_ = kHTTPProxyUsingTunnel;
- else
- proxy_mode_ = kHTTPProxy;
-
// Build the string used to uniquely identify connections of this type.
// Determine the host and port to connect to.
std::string connection_group;
@@ -716,7 +705,7 @@ int HttpNetworkTransaction::DoInitConnection() {
endpoint.host = request_->url.HostNoBrackets();
endpoint.port = request_->url.EffectiveIntPort();
- if (proxy_mode_ != kDirectConnection) {
+ if (!proxy_info_.is_direct()) {
ProxyServer proxy_server = proxy_info_.proxy_server();
connection_group = "proxy/" + proxy_server.ToURI() + "/";
peer_.host = proxy_server.HostNoBrackets();
@@ -760,9 +749,9 @@ int HttpNetworkTransaction::DoInitConnection() {
// (direct, HTTP proxy CONNECT, SOCKS), the connection is up to the
// url endpoint. Hence we append the url data into the connection_group.
// Note that the url endpoint may be different in the Alternate-Protocol case.
- if (proxy_mode_ == kDirectConnection)
+ if (proxy_info_.is_direct())
connection_group = peer_.ToString();
- else if (proxy_mode_ != kHTTPProxy)
+ else if (using_ssl_ || proxy_info_.is_socks())
connection_group.append(endpoint.ToString());
DCHECK(!connection_group.empty());
@@ -775,7 +764,7 @@ int HttpNetworkTransaction::DoInitConnection() {
request_->referrer, disable_resolver_cache);
int rv;
- if (proxy_mode_ != kSOCKSProxy) {
+ if (!proxy_info_.is_socks()) {
rv = connection_->Init(connection_group, tcp_params, request_->priority,
&io_callback_, session_->tcp_socket_pool(),
net_log_);
@@ -826,12 +815,11 @@ int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
// Now we have a TCP connected socket. Perform other connection setup as
// needed.
UpdateConnectionTypeHistograms(CONNECTION_HTTP);
- if (using_ssl_ && (proxy_mode_ == kDirectConnection ||
- proxy_mode_ == kSOCKSProxy)) {
+ if (using_ssl_ && (proxy_info_.is_direct() || proxy_info_.is_socks())) {
next_state_ = STATE_SSL_CONNECT;
} else {
next_state_ = STATE_SEND_REQUEST;
- if (proxy_mode_ == kHTTPProxyUsingTunnel)
+ if (using_ssl_)
establishing_tunnel_ = true;
}
}
@@ -969,7 +957,7 @@ int HttpNetworkTransaction::DoSendRequest() {
&request_headers);
} else {
BuildRequestHeaders(request_, authorization_headers, request_body,
- proxy_mode_ == kHTTPProxy, &request_line,
+ !using_ssl_ && proxy_info_.is_http(), &request_line,
&request_headers);
}
@@ -1676,7 +1664,7 @@ int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) {
}
bool HttpNetworkTransaction::ShouldApplyProxyAuth() const {
- return (proxy_mode_ == kHTTPProxy) || establishing_tunnel_;
+ return (!using_ssl_ && proxy_info_.is_http()) || establishing_tunnel_;
}
bool HttpNetworkTransaction::ShouldApplyServerAuth() const {
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 6a52f43..eb6f06e 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -102,13 +102,6 @@ class HttpNetworkTransaction : public HttpTransaction {
STATE_NONE
};
- enum ProxyMode {
- kDirectConnection, // If using a direct connection
- kHTTPProxy, // If using a proxy for HTTP (not HTTPS)
- kHTTPProxyUsingTunnel, // If using a tunnel for HTTPS
- kSOCKSProxy, // If using a SOCKS proxy
- };
-
enum AlternateProtocolMode {
kUnspecified, // Unspecified, check HttpAlternateProtocols
kUsingAlternateProtocol, // Using an alternate protocol
@@ -322,7 +315,6 @@ class HttpNetworkTransaction : public HttpTransaction {
bool logged_response_time;
bool using_ssl_; // True if handling a HTTPS request
- ProxyMode proxy_mode_;
// True while establishing a tunnel. This allows the HTTP CONNECT
// request/response to reuse the STATE_SEND_REQUEST,
diff --git a/net/proxy/proxy_info.h b/net/proxy/proxy_info.h
index b18feb8..5555108 100644
--- a/net/proxy/proxy_info.h
+++ b/net/proxy/proxy_info.h
@@ -50,6 +50,20 @@ class ProxyInfo {
return proxy_list_.Get().is_direct();
}
+ // Returns true if the first valid proxy server is a http proxy.
+ bool is_http() const {
+ if (is_empty())
+ return false;
+ return proxy_server().is_http();
+ }
+
+ // Returns true if the first valid proxy server is a socks server.
+ bool is_socks() const {
+ if (is_empty())
+ return false;
+ return proxy_server().is_socks();
+ }
+
// Returns true if this proxy info has no proxies left to try.
bool is_empty() const {
return proxy_list_.IsEmpty();