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

Unified Diff: net/base/host_port_pair.cc

Issue 1755005: SPDY: Fix Alternate-Protocol. (Closed)
Patch Set: Address mbelshe's comments. Created 10 years, 8 months 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 | « net/base/host_port_pair.h ('k') | net/http/http_network_transaction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_port_pair.cc
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc
index 06a95fb4ee208e072707ee67e6aa8732252cf938..d4e7d4ec0b22bf9ee20c75d711c544685f8be934 100644
--- a/net/base/host_port_pair.cc
+++ b/net/base/host_port_pair.cc
@@ -7,8 +7,15 @@
namespace net {
+HostPortPair::HostPortPair() : port(0) {}
+HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port)
+ : host(in_host), port(in_port) {}
+
std::string HostPortPair::ToString() const {
- return StringPrintf("[Host: %s, Port: %u]", host.c_str(), port);
+ // Check to see if the host is an IPv6 address. If so, added brackets.
+ if (host.find(':') != std::string::npos)
+ return StringPrintf("[%s]:%u", host.c_str(), port);
+ return StringPrintf("%s:%u", host.c_str(), port);
}
} // namespace net
« no previous file with comments | « net/base/host_port_pair.h ('k') | net/http/http_network_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698