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

Side by Side Diff: net/base/host_port_pair.cc

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « net/base/host_port_pair.h ('k') | net/http/bidirectional_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 10 matching lines...) Expand all
21 : host_(in_host), port_(in_port) { 21 : host_(in_host), port_(in_port) {
22 } 22 }
23 23
24 // static 24 // static
25 HostPortPair HostPortPair::FromURL(const GURL& url) { 25 HostPortPair HostPortPair::FromURL(const GURL& url) {
26 return HostPortPair(url.HostNoBrackets(), 26 return HostPortPair(url.HostNoBrackets(),
27 static_cast<uint16_t>(url.EffectiveIntPort())); 27 static_cast<uint16_t>(url.EffectiveIntPort()));
28 } 28 }
29 29
30 // static 30 // static
31 HostPortPair HostPortPair::FromSchemeHostPort(
32 const url::SchemeHostPort& origin) {
33 return HostPortPair(origin.host(), origin.port());
34 }
35
36 // static
31 HostPortPair HostPortPair::FromIPEndPoint(const IPEndPoint& ipe) { 37 HostPortPair HostPortPair::FromIPEndPoint(const IPEndPoint& ipe) {
32 return HostPortPair(ipe.ToStringWithoutPort(), ipe.port()); 38 return HostPortPair(ipe.ToStringWithoutPort(), ipe.port());
33 } 39 }
34 40
35 HostPortPair HostPortPair::FromString(const std::string& str) { 41 HostPortPair HostPortPair::FromString(const std::string& str) {
36 std::vector<base::StringPiece> key_port = base::SplitStringPiece( 42 std::vector<base::StringPiece> key_port = base::SplitStringPiece(
37 str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 43 str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
38 if (key_port.size() != 2) 44 if (key_port.size() != 2)
39 return HostPortPair(); 45 return HostPortPair();
40 int port; 46 int port;
(...skipping 27 matching lines...) Expand all
68 // Check to see if the host is an IPv6 address. If so, added brackets. 74 // Check to see if the host is an IPv6 address. If so, added brackets.
69 if (host_.find(':') != std::string::npos) { 75 if (host_.find(':') != std::string::npos) {
70 DCHECK_NE(host_[0], '['); 76 DCHECK_NE(host_[0], '[');
71 return base::StringPrintf("[%s]", host_.c_str()); 77 return base::StringPrintf("[%s]", host_.c_str());
72 } 78 }
73 79
74 return host_; 80 return host_;
75 } 81 }
76 82
77 } // namespace net 83 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_port_pair.h ('k') | net/http/bidirectional_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698