| 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_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 std::string ToString() const; | 133 std::string ToString() const; |
| 134 | 134 |
| 135 AlternateProtocol protocol; | 135 AlternateProtocol protocol; |
| 136 std::string host; | 136 std::string host; |
| 137 uint16_t port; | 137 uint16_t port; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 struct NET_EXPORT AlternativeServiceInfo { | 140 struct NET_EXPORT AlternativeServiceInfo { |
| 141 AlternativeServiceInfo() : alternative_service(), probability(0.0) {} | 141 AlternativeServiceInfo() : alternative_service() {} |
| 142 | 142 |
| 143 AlternativeServiceInfo(const AlternativeService& alternative_service, | 143 AlternativeServiceInfo(const AlternativeService& alternative_service, |
| 144 double probability, | |
| 145 base::Time expiration) | 144 base::Time expiration) |
| 146 : alternative_service(alternative_service), | 145 : alternative_service(alternative_service), |
| 147 probability(probability), | |
| 148 expiration(expiration) {} | 146 expiration(expiration) {} |
| 149 | 147 |
| 150 AlternativeServiceInfo(AlternateProtocol protocol, | 148 AlternativeServiceInfo(AlternateProtocol protocol, |
| 151 const std::string& host, | 149 const std::string& host, |
| 152 uint16_t port, | 150 uint16_t port, |
| 153 double probability, | |
| 154 base::Time expiration) | 151 base::Time expiration) |
| 155 : alternative_service(protocol, host, port), | 152 : alternative_service(protocol, host, port), |
| 156 probability(probability), | |
| 157 expiration(expiration) {} | 153 expiration(expiration) {} |
| 158 | 154 |
| 159 AlternativeServiceInfo( | 155 AlternativeServiceInfo( |
| 160 const AlternativeServiceInfo& alternative_service_info) = default; | 156 const AlternativeServiceInfo& alternative_service_info) = default; |
| 161 AlternativeServiceInfo& operator=( | 157 AlternativeServiceInfo& operator=( |
| 162 const AlternativeServiceInfo& alternative_service_info) = default; | 158 const AlternativeServiceInfo& alternative_service_info) = default; |
| 163 | 159 |
| 164 bool operator==(const AlternativeServiceInfo& other) const { | 160 bool operator==(const AlternativeServiceInfo& other) const { |
| 165 return alternative_service == other.alternative_service && | 161 return alternative_service == other.alternative_service && |
| 166 probability == other.probability && expiration == other.expiration; | 162 expiration == other.expiration; |
| 167 } | 163 } |
| 168 | 164 |
| 169 bool operator!=(const AlternativeServiceInfo& other) const { | 165 bool operator!=(const AlternativeServiceInfo& other) const { |
| 170 return !this->operator==(other); | 166 return !this->operator==(other); |
| 171 } | 167 } |
| 172 | 168 |
| 173 std::string ToString() const; | 169 std::string ToString() const; |
| 174 | 170 |
| 175 AlternativeService alternative_service; | 171 AlternativeService alternative_service; |
| 176 double probability; | |
| 177 base::Time expiration; | 172 base::Time expiration; |
| 178 }; | 173 }; |
| 179 | 174 |
| 180 struct NET_EXPORT SupportsQuic { | 175 struct NET_EXPORT SupportsQuic { |
| 181 SupportsQuic() : used_quic(false) {} | 176 SupportsQuic() : used_quic(false) {} |
| 182 SupportsQuic(bool used_quic, const std::string& address) | 177 SupportsQuic(bool used_quic, const std::string& address) |
| 183 : used_quic(used_quic), | 178 : used_quic(used_quic), |
| 184 address(address) {} | 179 address(address) {} |
| 185 | 180 |
| 186 bool Equals(const SupportsQuic& other) const { | 181 bool Equals(const SupportsQuic& other) const { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Require HTTP/1.1 on subsequent connections. Not persisted. | 253 // Require HTTP/1.1 on subsequent connections. Not persisted. |
| 259 virtual void SetHTTP11Required(const HostPortPair& server) = 0; | 254 virtual void SetHTTP11Required(const HostPortPair& server) = 0; |
| 260 | 255 |
| 261 // Modify SSLConfig to force HTTP/1.1. | 256 // Modify SSLConfig to force HTTP/1.1. |
| 262 static void ForceHTTP11(SSLConfig* ssl_config); | 257 static void ForceHTTP11(SSLConfig* ssl_config); |
| 263 | 258 |
| 264 // Modify SSLConfig to force HTTP/1.1 if necessary. | 259 // Modify SSLConfig to force HTTP/1.1 if necessary. |
| 265 virtual void MaybeForceHTTP11(const HostPortPair& server, | 260 virtual void MaybeForceHTTP11(const HostPortPair& server, |
| 266 SSLConfig* ssl_config) = 0; | 261 SSLConfig* ssl_config) = 0; |
| 267 | 262 |
| 268 // Return all alternative services for |origin| with probability greater than | 263 // Return all alternative services for |origin|, including broken ones. |
| 269 // or equal to the threshold, including broken ones. | |
| 270 // Returned alternative services never have empty hostnames. | 264 // Returned alternative services never have empty hostnames. |
| 271 virtual AlternativeServiceVector GetAlternativeServices( | 265 virtual AlternativeServiceVector GetAlternativeServices( |
| 272 const HostPortPair& origin) = 0; | 266 const HostPortPair& origin) = 0; |
| 273 | 267 |
| 274 // Set a single alternative service for |origin|. Previous alternative | 268 // Set a single alternative service for |origin|. Previous alternative |
| 275 // services for |origin| are discarded. | 269 // services for |origin| are discarded. |
| 276 // |alternative_service.host| may be empty. | 270 // |alternative_service.host| may be empty. |
| 277 // Return true if |alternative_service_map_| is changed. | 271 // Return true if |alternative_service_map_| is changed. |
| 278 virtual bool SetAlternativeService( | 272 virtual bool SetAlternativeService( |
| 279 const HostPortPair& origin, | 273 const HostPortPair& origin, |
| 280 const AlternativeService& alternative_service, | 274 const AlternativeService& alternative_service, |
| 281 double alternative_probability, | |
| 282 base::Time expiration) = 0; | 275 base::Time expiration) = 0; |
| 283 | 276 |
| 284 // Set alternative services for |origin|. Previous alternative services for | 277 // Set alternative services for |origin|. Previous alternative services for |
| 285 // |origin| are discarded. | 278 // |origin| are discarded. |
| 286 // Hostnames in |alternative_service_info_vector| may be empty. | 279 // Hostnames in |alternative_service_info_vector| may be empty. |
| 287 // Return true if |alternative_service_map_| is changed. | 280 // Return true if |alternative_service_map_| is changed. |
| 288 virtual bool SetAlternativeServices( | 281 virtual bool SetAlternativeServices( |
| 289 const HostPortPair& origin, | 282 const HostPortPair& origin, |
| 290 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; | 283 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; |
| 291 | 284 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 318 virtual void ClearAlternativeServices(const HostPortPair& origin) = 0; | 311 virtual void ClearAlternativeServices(const HostPortPair& origin) = 0; |
| 319 | 312 |
| 320 // Returns all alternative service mappings. | 313 // Returns all alternative service mappings. |
| 321 // Returned alternative services may have empty hostnames. | 314 // Returned alternative services may have empty hostnames. |
| 322 virtual const AlternativeServiceMap& alternative_service_map() const = 0; | 315 virtual const AlternativeServiceMap& alternative_service_map() const = 0; |
| 323 | 316 |
| 324 // Returns all alternative service mappings as human readable strings. | 317 // Returns all alternative service mappings as human readable strings. |
| 325 // Empty alternative service hostnames will be printed as such. | 318 // Empty alternative service hostnames will be printed as such. |
| 326 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0; | 319 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0; |
| 327 | 320 |
| 328 // Sets the threshold to be used when evaluating alternative service | |
| 329 // advertisments. Only advertisements with a probability greater than or equal | |
| 330 // to |threshold| will be honored. |threshold| must be between 0.0 and 1.0 | |
| 331 // inclusive. Hence, a threshold of 0.0 implies that all advertisements will | |
| 332 // be honored. | |
| 333 virtual void SetAlternativeServiceProbabilityThreshold(double threshold) = 0; | |
| 334 | |
| 335 // Gets a reference to the SettingsMap stored for a host. | 321 // Gets a reference to the SettingsMap stored for a host. |
| 336 // If no settings are stored, returns an empty SettingsMap. | 322 // If no settings are stored, returns an empty SettingsMap. |
| 337 virtual const SettingsMap& GetSpdySettings( | 323 virtual const SettingsMap& GetSpdySettings( |
| 338 const HostPortPair& host_port_pair) = 0; | 324 const HostPortPair& host_port_pair) = 0; |
| 339 | 325 |
| 340 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 326 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
| 341 // is to be persisted. | 327 // is to be persisted. |
| 342 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 328 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
| 343 SpdySettingsIds id, | 329 SpdySettingsIds id, |
| 344 SpdySettingsFlags flags, | 330 SpdySettingsFlags flags, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 virtual void SetMaxServerConfigsStoredInProperties( | 372 virtual void SetMaxServerConfigsStoredInProperties( |
| 387 size_t max_server_configs_stored_in_properties) = 0; | 373 size_t max_server_configs_stored_in_properties) = 0; |
| 388 | 374 |
| 389 private: | 375 private: |
| 390 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 376 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 391 }; | 377 }; |
| 392 | 378 |
| 393 } // namespace net | 379 } // namespace net |
| 394 | 380 |
| 395 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 381 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |