summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 21:49:40 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 21:49:40 +0000
commitfae7669f438f42169f9da35406d9b4cef6b541fd (patch)
tree3b13582d0f9ed536194e9fc36818ebf1b31b8639
parentabd701d7cd8b601b5f13c6ff2d56eccf9f22fa64 (diff)
downloadchromium_src-fae7669f438f42169f9da35406d9b4cef6b541fd.zip
chromium_src-fae7669f438f42169f9da35406d9b4cef6b541fd.tar.gz
chromium_src-fae7669f438f42169f9da35406d9b4cef6b541fd.tar.bz2
Address a TODO: use HostPortPair rather than a naked host string.
Review URL: http://codereview.chromium.org/3047033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54613 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/importer/firefox_proxy_settings.cc12
-rw-r--r--net/http/http_network_transaction_unittest.cc4
-rw-r--r--net/proxy/proxy_server.cc6
-rw-r--r--net/proxy/proxy_server.h7
-rw-r--r--net/proxy/proxy_server_mac.cc4
5 files changed, 13 insertions, 20 deletions
diff --git a/chrome/browser/importer/firefox_proxy_settings.cc b/chrome/browser/importer/firefox_proxy_settings.cc
index 0f8ff39..9c3166b 100644
--- a/chrome/browser/importer/firefox_proxy_settings.cc
+++ b/chrome/browser/importer/firefox_proxy_settings.cc
@@ -127,22 +127,19 @@ bool FirefoxProxySettings::ToProxyConfig(net::ProxyConfig* config) {
if (!http_proxy().empty()) {
config->proxy_rules().proxy_for_http = net::ProxyServer(
net::ProxyServer::SCHEME_HTTP,
- http_proxy(),
- http_proxy_port());
+ net::HostPortPair(http_proxy(), http_proxy_port()));
}
if (!ftp_proxy().empty()) {
config->proxy_rules().proxy_for_ftp = net::ProxyServer(
net::ProxyServer::SCHEME_HTTP,
- ftp_proxy(),
- ftp_proxy_port());
+ net::HostPortPair(ftp_proxy(), ftp_proxy_port()));
}
if (!ssl_proxy().empty()) {
config->proxy_rules().proxy_for_https = net::ProxyServer(
net::ProxyServer::SCHEME_HTTP,
- ssl_proxy(),
- ssl_proxy_port());
+ net::HostPortPair(ssl_proxy(), ssl_proxy_port()));
}
if (!socks_host().empty()) {
@@ -151,8 +148,7 @@ bool FirefoxProxySettings::ToProxyConfig(net::ProxyConfig* config) {
config->proxy_rules().socks_proxy = net::ProxyServer(
proxy_scheme,
- socks_host(),
- socks_port());
+ net::HostPortPair(socks_host(), socks_port()));
}
config->proxy_rules().bypass_rules.ParseFromStringUsingSuffixMatching(
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index ec54865..4e0d354 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -5408,8 +5408,8 @@ class CapturingProxyResolver : public ProxyResolver {
CompletionCallback* callback,
RequestHandle* request,
const BoundNetLog& net_log) {
- ProxyServer proxy_server(
- ProxyServer::SCHEME_HTTP, "myproxy", 80);
+ ProxyServer proxy_server(ProxyServer::SCHEME_HTTP,
+ HostPortPair("myproxy", 80));
results->UseProxyServer(proxy_server);
resolved_.push_back(url);
return OK;
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 792a47d..f172a6b 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -70,8 +70,8 @@ std::string HostNoBrackets(const std::string& host) {
} // namespace
-ProxyServer::ProxyServer(Scheme scheme, const std::string& host, int port)
- : scheme_(scheme), host_port_pair_(HostNoBrackets(host), port) {
+ProxyServer::ProxyServer(Scheme scheme, const HostPortPair& host_port_pair)
+ : scheme_(scheme), host_port_pair_(host_port_pair) {
}
const HostPortPair& ProxyServer::host_port_pair() const {
@@ -222,7 +222,7 @@ ProxyServer ProxyServer::FromSchemeHostAndPort(
if (port == -1)
port = GetDefaultPortForScheme(scheme);
- return ProxyServer(scheme, host, port);
+ return ProxyServer(scheme, HostPortPair(HostNoBrackets(host), port));
}
} // namespace net
diff --git a/net/proxy/proxy_server.h b/net/proxy/proxy_server.h
index 18124fc..689fd6b 100644
--- a/net/proxy/proxy_server.h
+++ b/net/proxy/proxy_server.h
@@ -38,10 +38,7 @@ class ProxyServer {
// Constructs an invalid ProxyServer.
ProxyServer() : scheme_(SCHEME_INVALID) {}
- // TODO(thestig) Replace |host| and |port| with HostPortPair.
- // If |host| is an IPv6 literal address, it must include the square
- // brackets.
- ProxyServer(Scheme scheme, const std::string& host, int port);
+ ProxyServer(Scheme scheme, const HostPortPair& host_port_pair);
bool is_valid() const { return scheme_ != SCHEME_INVALID; }
@@ -108,7 +105,7 @@ class ProxyServer {
// Returns a ProxyServer representing DIRECT connections.
static ProxyServer Direct() {
- return ProxyServer(SCHEME_DIRECT, std::string(), -1);
+ return ProxyServer(SCHEME_DIRECT, HostPortPair());
}
#if defined(OS_MACOSX)
diff --git a/net/proxy/proxy_server_mac.cc b/net/proxy/proxy_server_mac.cc
index 44c21cd..61e320f 100644
--- a/net/proxy/proxy_server_mac.cc
+++ b/net/proxy/proxy_server_mac.cc
@@ -21,7 +21,7 @@ ProxyServer ProxyServer::FromDictionary(Scheme scheme,
CFStringRef port_key) {
if (scheme == SCHEME_INVALID || scheme == SCHEME_DIRECT) {
// No hostname port to extract; we are done.
- return ProxyServer(scheme, std::string(), -1);
+ return ProxyServer(scheme, HostPortPair());
}
CFStringRef host_ref =
@@ -45,7 +45,7 @@ ProxyServer ProxyServer::FromDictionary(Scheme scheme,
port = GetDefaultPortForScheme(scheme);
}
- return ProxyServer(scheme, host, port);
+ return ProxyServer(scheme, HostPortPair(host, port));
}
} // namespace net