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

Side by Side Diff: url/scheme_host_port.h

Issue 1858093002: Alt-Svc 8: Change Supports SPDY list using SHP as the key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alt_svc_7
Patch Set: server pref changes 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/spdy/spdy_session_unittest.cc ('k') | url/scheme_host_port.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef URL_SCHEME_HOST_PORT_H_ 5 #ifndef URL_SCHEME_HOST_PORT_H_
6 #define URL_SCHEME_HOST_PORT_H_ 6 #define URL_SCHEME_HOST_PORT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // Creates a (scheme, host, port) tuple from |url|, as described at 89 // Creates a (scheme, host, port) tuple from |url|, as described at
90 // https://tools.ietf.org/html/rfc6454#section-4 90 // https://tools.ietf.org/html/rfc6454#section-4
91 // 91 //
92 // If |url| is invalid or non-standard, the result will be an invalid 92 // If |url| is invalid or non-standard, the result will be an invalid
93 // SchemeHostPort object. 93 // SchemeHostPort object.
94 explicit SchemeHostPort(const GURL& url); 94 explicit SchemeHostPort(const GURL& url);
95 95
96 ~SchemeHostPort(); 96 ~SchemeHostPort();
97 97
98 static SchemeHostPort FromString(const std::string& url_string);
99
98 // Returns the host component, in URL form. That is all IDN domain names will 100 // Returns the host component, in URL form. That is all IDN domain names will
99 // be expressed as A-Labels ('☃.net' will be returned as 'xn--n3h.net'), and 101 // be expressed as A-Labels ('☃.net' will be returned as 'xn--n3h.net'), and
100 // and all IPv6 addresses will be enclosed in brackets ("[2001:db8::1]"). 102 // and all IPv6 addresses will be enclosed in brackets ("[2001:db8::1]").
101 const std::string& host() const { return host_; } 103 const std::string& host() const { return host_; }
102 const std::string& scheme() const { return scheme_; } 104 const std::string& scheme() const { return scheme_; }
103 uint16_t port() const { return port_; } 105 uint16_t port() const { return port_; }
104 bool IsInvalid() const; 106 bool IsInvalid() const;
105 107
106 // Serializes the SchemeHostPort tuple to a canonical form. 108 // Serializes the SchemeHostPort tuple to a canonical form.
107 // 109 //
108 // While this string form resembles the Origin serialization specified in 110 // While this string form resembles the Origin serialization specified in
109 // Section 6.2 of RFC 6454, it is important to note that invalid 111 // Section 6.2 of RFC 6454, it is important to note that invalid
110 // SchemeHostPort tuples serialize to the empty string, rather than being 112 // SchemeHostPort tuples serialize to the empty string, rather than being
111 // serialized as a unique Origin. 113 // serialized as a unique Origin.
112 std::string Serialize() const; 114 std::string Serialize() const;
113 115
116 // ToString() will convert the SchemeHostPort to "scheme://host:port".
117 std::string ToString() const;
118
114 // Two SchemeHostPort objects are "equal" iff their schemes, hosts, and ports 119 // Two SchemeHostPort objects are "equal" iff their schemes, hosts, and ports
115 // are exact matches. 120 // are exact matches.
116 // 121 //
117 // Note that this comparison is _not_ the same as an origin-based comparison. 122 // Note that this comparison is _not_ the same as an origin-based comparison.
118 // In particular, invalid SchemeHostPort objects match each other (and 123 // In particular, invalid SchemeHostPort objects match each other (and
119 // themselves). Unique origins, on the other hand, would not. 124 // themselves). Unique origins, on the other hand, would not.
120 bool Equals(const SchemeHostPort& other) const; 125 bool Equals(const SchemeHostPort& other) const;
121 126
122 // Allows SchemeHostPort to be used as a key in STL (for example, a std::set 127 // Allows SchemeHostPort to be used as a key in STL (for example, a std::set
123 // or std::map). 128 // or std::map).
124 bool operator<(const SchemeHostPort& other) const; 129 bool operator<(const SchemeHostPort& other) const;
125 130
126 private: 131 private:
127 std::string scheme_; 132 std::string scheme_;
128 std::string host_; 133 std::string host_;
129 uint16_t port_; 134 uint16_t port_;
130 }; 135 };
131 136
132 } // namespace url 137 } // namespace url
133 138
134 #endif // URL_SCHEME_HOST_PORT_H_ 139 #endif // URL_SCHEME_HOST_PORT_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | url/scheme_host_port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698