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

Unified Diff: net/http/http_server_properties_impl.h

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Custom entries for broken_alternate_protocol_list_ and map_. Created 5 years, 11 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
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl.h
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h
index 7a5441c57fbebffea2432701bead388ae51f67cb..bd0a9e68407e6eace08f94010e53256dc565e11e 100644
--- a/net/http/http_server_properties_impl.h
+++ b/net/http/http_server_properties_impl.h
@@ -93,32 +93,49 @@ class NET_EXPORT HttpServerPropertiesImpl
void MaybeForceHTTP11(const HostPortPair& server,
SSLConfig* ssl_config) override;
- // Returns true if |server| has an Alternate-Protocol header.
+ // Returns true iff |server| has a non-broken AlternateProtocol with
+ // probability exceeding threshold, or if AlternateProtocol is forced.
+ // TODO(bnc): Rename to HasAlternativeService.
bool HasAlternateProtocol(const HostPortPair& server) override;
- // Returns the Alternate-Protocol and port for |server|.
- // HasAlternateProtocol(server) must be true.
+ // Returns the first non-broken AlternateProtocol with probability exceeding
+ // threshold for |server|, or forced AlternateProtocol, or one with
+ // UNINITIALIZED_ALTERNATE_PROTOCOL.
AlternateProtocolInfo GetAlternateProtocol(
const HostPortPair& server) override;
- // Sets the Alternate-Protocol for |server|.
- void SetAlternateProtocol(const HostPortPair& server,
+ // Adds an Alternate-Protocol for |server|.
+ void AddAlternateProtocol(const HostPortPair& server,
uint16 alternate_port,
AlternateProtocol alternate_protocol,
double probability) override;
- // Sets the Alternate-Protocol for |server| to be BROKEN.
- void SetBrokenAlternateProtocol(const HostPortPair& server) override;
+ // Sets a given Alternate-Protocol for |server| to be broken.
+ void SetBrokenAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& broken_alternate_protocol) override;
- // Returns true if Alternate-Protocol for |server| was recently BROKEN.
- bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override;
+ // Returns true if given Alternate-Protocol for |server| was recently broken.
+ bool WasAlternateProtocolRecentlyBroken(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) override;
- // Confirms that Alternate-Protocol for |server| is working.
- void ConfirmAlternateProtocol(const HostPortPair& server) override;
+ // Confirms that given Alternate-Protocol for |server| is working.
+ void ConfirmAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) override;
- // Clears the Alternate-Protocol for |server|.
+ // Clears all Alternate-Protocols for |server|.
void ClearAlternateProtocol(const HostPortPair& server) override;
+ // Clears all Alternate-Protocols that are not broken for |server|.
+ void ClearNonBrokenAlternateProtocols(const HostPortPair& server) override;
+
+ // Removes an Alternate-Protocol for |server|.
+ void RemoveAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) override;
+
// Returns all Alternate-Protocol mappings.
const AlternateProtocolMap& alternate_protocol_map() const override;
@@ -171,16 +188,45 @@ class NET_EXPORT HttpServerPropertiesImpl
typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap;
typedef std::vector<std::string> CanonicalSufficList;
typedef std::set<HostPortPair> Http11ServerHostPortSet;
- // List of broken host:ports and the times when they can be expired.
+ // Server, port, and AlternateProtocol: an entity that can be broken. (Once
+ // we use AlternativeService, the same AltSvc can be broken for one server but
+ // not for another depending on what certificate it can offer.)
struct BrokenAlternateProtocolEntry {
+ BrokenAlternateProtocolEntry(const BrokenAlternateProtocolEntry&) = default;
+ BrokenAlternateProtocolEntry(const HostPortPair& server,
+ uint16 port,
+ AlternateProtocol protocol)
+ : server(server), port(port), protocol(protocol) {}
+
+ bool operator<(const BrokenAlternateProtocolEntry& other) const {
+ if (!server.Equals(other.server))
+ return server < other.server;
+ if (port != other.port)
+ return port < other.port;
+ return protocol < other.protocol;
+ }
+
HostPortPair server;
+ uint16 port;
+ AlternateProtocol protocol;
+ };
+ // List of BrokenAlternateProtocolEntries with when they can be expired.
+ struct BrokenAlternateProtocolEntryWithTime {
+ BrokenAlternateProtocolEntryWithTime(
+ const BrokenAlternateProtocolEntry& broken_alternate_protocol_entry,
+ base::TimeTicks when)
+ : broken_alternate_protocol_entry(broken_alternate_protocol_entry),
+ when(when) {}
+
+ BrokenAlternateProtocolEntry broken_alternate_protocol_entry;
base::TimeTicks when;
};
- typedef std::list<BrokenAlternateProtocolEntry>
+ typedef std::list<BrokenAlternateProtocolEntryWithTime>
BrokenAlternateProtocolList;
// Map from host:port to the number of times alternate protocol has
// been marked broken.
- typedef std::map<HostPortPair, int> BrokenAlternateProtocolMap;
+ typedef std::map<BrokenAlternateProtocolEntry, int>
+ BrokenAlternateProtocolMap;
// Return the iterator for |server|, or for its canonical host, or end.
AlternateProtocolMap::const_iterator GetAlternateProtocolIterator(
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698