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 |