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

Unified Diff: net/http/http_server_properties.cc

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittests Created 4 years, 9 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
Index: net/http/http_server_properties.cc
diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc
index fc6281e43b5b9c11405ab98936e04a1b668d7c36..50cda270c292265126aaa3bad921385095568339 100644
--- a/net/http/http_server_properties.cc
+++ b/net/http/http_server_properties.cc
@@ -104,6 +104,37 @@ std::string AlternativeServiceInfo::ToString() const {
exploded.minute, exploded.second);
}
+SchemeOriginPair::SchemeOriginPair() : host_port_pair_() {}
+
+SchemeOriginPair::SchemeOriginPair(const std::string& in_scheme,
+ const HostPortPair& in_host_port)
+ : SchemeOriginPair(in_scheme, in_host_port.host(), in_host_port.port()) {}
+
+SchemeOriginPair::SchemeOriginPair(const std::string& in_scheme,
+ const std::string& in_host,
+ uint16_t in_port)
+ : scheme_(in_scheme), host_port_pair_(in_host, in_port) {}
+
+// static
+SchemeOriginPair SchemeOriginPair::FromURL(const GURL& url) {
+ return SchemeOriginPair(url.scheme(), url.HostNoBrackets(),
+ static_cast<uint16_t>(url.EffectiveIntPort()));
+}
+
+bool SchemeOriginPair::Equals(const SchemeOriginPair& other) const {
+ return scheme_ == other.scheme_ &&
+ host_port_pair_.Equals(other.host_port_pair());
+}
+
+bool SchemeOriginPair::IsEmpty() const {
+ return host_port_pair_.host().empty() && host_port_pair_.port() == 0;
+}
+
+bool SchemeOriginPair::operator<(const SchemeOriginPair& other) const {
+ return std::tie(scheme_, host_port_pair_) <
+ std::tie(other.scheme_, other.host_port_pair_);
+}
+
// static
void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) {
ssl_config->alpn_protos.clear();

Powered by Google App Engine
This is Rietveld 408576698