return ProxyServer::SCHEME_INVALID;
}
-std::string HostNoBrackets(const std::string& host) {
- // Remove brackets from an RFC 2732-style IPv6 literal address.
- const std::string::size_type len = host.size();
- if (len >= 2 && host[0] == '[' && host[len - 1] == ']')
- return host.substr(1, len - 2);
- return host;
-}
-
} // namespace
ProxyServer::ProxyServer(Scheme scheme, const HostPortPair& host_port_pair)
const HostPortPair& ProxyServer::host_port_pair() const {
// Doesn't make sense to call this if the URI scheme doesn't
// have concept of a host.
- DCHECK(is_valid() && !is_direct());
+ DCHECK(is_valid());
+ DCHECK(!is_direct());
return host_port_pair_;
}
if (port == -1)
port = GetDefaultPortForScheme(scheme);
- host_port_pair = HostPortPair(HostNoBrackets(host), port);
+ host_port_pair = HostPortPair(host, port);
}
return ProxyServer(scheme, host_port_pair);