Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4051)

Unified Diff: chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc

Issue 1440063002: Use net::HostPortPair::HostForURL to fix IPv6 in URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@context4
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc
diff --git a/chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc b/chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc
index b01795490fd24402ec0a25e9bb82ad08d8234a43..8e2b2c6cc529b91ab62ebb064aa6dfbf21223f10 100644
--- a/chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc
+++ b/chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc
@@ -14,21 +14,6 @@
namespace local_discovery {
-namespace {
-
-std::string IPAddressToHostString(const net::IPAddressNumber& address) {
- std::string address_str = net::IPAddressToString(address);
-
- // IPv6 addresses need to be surrounded by brackets.
- if (address.size() == net::kIPv6AddressSize) {
- address_str = base::StringPrintf("[%s]", address_str.c_str());
- }
-
- return address_str;
-}
-
-} // namespace
-
PrivetHTTPAsynchronousFactoryImpl::PrivetHTTPAsynchronousFactoryImpl(
net::URLRequestContextGetter* request_context)
: request_context_(request_context) {
@@ -119,7 +104,7 @@ void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::DomainResolveComplete(
DCHECK(!address.empty());
net::HostPortPair new_address =
- net::HostPortPair(IPAddressToHostString(address), port);
+ net::HostPortPair::FromIPEndPoint(net::IPEndPoint(address, port));
callback.Run(scoped_ptr<PrivetHTTPClient>(
new PrivetHTTPClientImpl(name_, new_address, request_context_.get())));
}
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698