| 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 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 static void DisableForcedAlternateProtocol(); | 64 static void DisableForcedAlternateProtocol(); |
| 65 | 65 |
| 66 // Returns the canonical host suffix for |server|, or std::string() if none | 66 // Returns the canonical host suffix for |server|, or std::string() if none |
| 67 // exists. | 67 // exists. |
| 68 std::string GetCanonicalSuffix(const HostPortPair& server); | 68 std::string GetCanonicalSuffix(const HostPortPair& server); |
| 69 | 69 |
| 70 // ----------------------------- | 70 // ----------------------------- |
| 71 // HttpServerProperties methods: | 71 // HttpServerProperties methods: |
| 72 // ----------------------------- | 72 // ----------------------------- |
| 73 | 73 |
| 74 // Gets a weak pointer for this object. | |
| 75 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; | 74 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; |
| 76 | |
| 77 // Deletes all data. | |
| 78 void Clear() override; | 75 void Clear() override; |
| 79 | |
| 80 // Returns true if |server| supports SPDY. | |
| 81 bool SupportsSpdy(const HostPortPair& server) override; | 76 bool SupportsSpdy(const HostPortPair& server) override; |
| 82 | |
| 83 // Add |server| into the persistent store. | |
| 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; | 77 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; |
| 85 | |
| 86 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. | |
| 87 bool RequiresHTTP11(const HostPortPair& server) override; | 78 bool RequiresHTTP11(const HostPortPair& server) override; |
| 88 | |
| 89 // Require HTTP/1.1 on subsequent connections. Not persisted. | |
| 90 void SetHTTP11Required(const HostPortPair& server) override; | 79 void SetHTTP11Required(const HostPortPair& server) override; |
| 91 | |
| 92 // Modify SSLConfig to force HTTP/1.1 if necessary. | |
| 93 void MaybeForceHTTP11(const HostPortPair& server, | 80 void MaybeForceHTTP11(const HostPortPair& server, |
| 94 SSLConfig* ssl_config) override; | 81 SSLConfig* ssl_config) override; |
| 95 | |
| 96 // Returns true if |server| has an Alternate-Protocol header. | |
| 97 bool HasAlternateProtocol(const HostPortPair& server) override; | 82 bool HasAlternateProtocol(const HostPortPair& server) override; |
| 98 | |
| 99 // Returns the Alternate-Protocol and port for |server|. | |
| 100 // HasAlternateProtocol(server) must be true. | |
| 101 AlternateProtocolInfo GetAlternateProtocol( | 83 AlternateProtocolInfo GetAlternateProtocol( |
| 102 const HostPortPair& server) override; | 84 const HostPortPair& server) override; |
| 103 | |
| 104 // Sets the Alternate-Protocol for |server|. | |
| 105 void SetAlternateProtocol(const HostPortPair& server, | 85 void SetAlternateProtocol(const HostPortPair& server, |
| 106 uint16 alternate_port, | 86 uint16 alternate_port, |
| 107 AlternateProtocol alternate_protocol, | 87 AlternateProtocol alternate_protocol, |
| 108 double probability) override; | 88 double probability) override; |
| 109 | |
| 110 // Sets the Alternate-Protocol for |server| to be BROKEN. | |
| 111 void SetBrokenAlternateProtocol(const HostPortPair& server) override; | 89 void SetBrokenAlternateProtocol(const HostPortPair& server) override; |
| 112 | |
| 113 // Returns true if Alternate-Protocol for |server| was recently BROKEN. | |
| 114 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; | 90 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; |
| 115 | |
| 116 // Confirms that Alternate-Protocol for |server| is working. | |
| 117 void ConfirmAlternateProtocol(const HostPortPair& server) override; | 91 void ConfirmAlternateProtocol(const HostPortPair& server) override; |
| 118 | |
| 119 // Clears the Alternate-Protocol for |server|. | |
| 120 void ClearAlternateProtocol(const HostPortPair& server) override; | 92 void ClearAlternateProtocol(const HostPortPair& server) override; |
| 121 | |
| 122 // Returns all Alternate-Protocol mappings. | |
| 123 const AlternateProtocolMap& alternate_protocol_map() const override; | 93 const AlternateProtocolMap& alternate_protocol_map() const override; |
| 124 | |
| 125 void SetAlternateProtocolProbabilityThreshold(double threshold) override; | 94 void SetAlternateProtocolProbabilityThreshold(double threshold) override; |
| 126 | |
| 127 // Gets a reference to the SettingsMap stored for a host. | |
| 128 // If no settings are stored, returns an empty SettingsMap. | |
| 129 const SettingsMap& GetSpdySettings( | 95 const SettingsMap& GetSpdySettings( |
| 130 const HostPortPair& host_port_pair) override; | 96 const HostPortPair& host_port_pair) override; |
| 131 | |
| 132 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | |
| 133 // is to be persisted. | |
| 134 bool SetSpdySetting(const HostPortPair& host_port_pair, | 97 bool SetSpdySetting(const HostPortPair& host_port_pair, |
| 135 SpdySettingsIds id, | 98 SpdySettingsIds id, |
| 136 SpdySettingsFlags flags, | 99 SpdySettingsFlags flags, |
| 137 uint32 value) override; | 100 uint32 value) override; |
| 138 | |
| 139 // Clears all entries in |spdy_settings_map_| for a host. | |
| 140 void ClearSpdySettings(const HostPortPair& host_port_pair) override; | 101 void ClearSpdySettings(const HostPortPair& host_port_pair) override; |
| 141 | |
| 142 // Clears all entries in |spdy_settings_map_|. | |
| 143 void ClearAllSpdySettings() override; | 102 void ClearAllSpdySettings() override; |
| 144 | |
| 145 // Returns all persistent SPDY settings. | |
| 146 const SpdySettingsMap& spdy_settings_map() const override; | 103 const SpdySettingsMap& spdy_settings_map() const override; |
| 147 | |
| 148 // Methods for SupportsQuic. | |
| 149 SupportsQuic GetSupportsQuic( | 104 SupportsQuic GetSupportsQuic( |
| 150 const HostPortPair& host_port_pair) const override; | 105 const HostPortPair& host_port_pair) const override; |
| 151 | |
| 152 void SetSupportsQuic(const HostPortPair& host_port_pair, | 106 void SetSupportsQuic(const HostPortPair& host_port_pair, |
| 153 bool used_quic, | 107 bool used_quic, |
| 154 const std::string& address) override; | 108 const std::string& address) override; |
| 155 | |
| 156 const SupportsQuicMap& supports_quic_map() const override; | 109 const SupportsQuicMap& supports_quic_map() const override; |
| 157 | |
| 158 // Methods for ServerNetworkStats. | |
| 159 void SetServerNetworkStats(const HostPortPair& host_port_pair, | 110 void SetServerNetworkStats(const HostPortPair& host_port_pair, |
| 160 ServerNetworkStats stats) override; | 111 ServerNetworkStats stats) override; |
| 161 | |
| 162 const ServerNetworkStats* GetServerNetworkStats( | 112 const ServerNetworkStats* GetServerNetworkStats( |
| 163 const HostPortPair& host_port_pair) override; | 113 const HostPortPair& host_port_pair) override; |
| 164 | |
| 165 const ServerNetworkStatsMap& server_network_stats_map() const override; | 114 const ServerNetworkStatsMap& server_network_stats_map() const override; |
| 166 | 115 |
| 167 private: | 116 private: |
| 168 // |spdy_servers_map_| has flattened representation of servers (host, port) | 117 // |spdy_servers_map_| has flattened representation of servers (host, port) |
| 169 // that either support or not support SPDY protocol. | 118 // that either support or not support SPDY protocol. |
| 170 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; | 119 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; |
| 171 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 120 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; |
| 172 typedef std::vector<std::string> CanonicalSufficList; | 121 typedef std::vector<std::string> CanonicalSufficList; |
| 173 typedef std::set<HostPortPair> Http11ServerHostPortSet; | 122 typedef std::set<HostPortPair> Http11ServerHostPortSet; |
| 174 // List of broken host:ports and the times when they can be expired. | 123 // List of broken host:ports and the times when they can be expired. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 double alternate_protocol_probability_threshold_; | 163 double alternate_protocol_probability_threshold_; |
| 215 | 164 |
| 216 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 165 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 217 | 166 |
| 218 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 167 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 219 }; | 168 }; |
| 220 | 169 |
| 221 } // namespace net | 170 } // namespace net |
| 222 | 171 |
| 223 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 172 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |