| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/host_port_pair.h" | 5 #include "net/base/host_port_pair.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "googleurl/src/gurl.h" | |
| 12 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
| 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 HostPortPair::HostPortPair() : port_(0) {} | 16 HostPortPair::HostPortPair() : port_(0) {} |
| 17 HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port) | 17 HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port) |
| 18 : host_(in_host), port_(in_port) {} | 18 : host_(in_host), port_(in_port) {} |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 HostPortPair HostPortPair::FromURL(const GURL& url) { | 21 HostPortPair HostPortPair::FromURL(const GURL& url) { |
| 22 return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort()); | 22 return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 // Check to see if the host is an IPv6 address. If so, added brackets. | 50 // Check to see if the host is an IPv6 address. If so, added brackets. |
| 51 if (host_.find(':') != std::string::npos) { | 51 if (host_.find(':') != std::string::npos) { |
| 52 DCHECK_NE(host_[0], '['); | 52 DCHECK_NE(host_[0], '['); |
| 53 return base::StringPrintf("[%s]", host_.c_str()); | 53 return base::StringPrintf("[%s]", host_.c_str()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 return host_; | 56 return host_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace net | 59 } // namespace net |
| OLD | NEW |