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

Side by Side Diff: net/http/http_server_properties.h

Issue 1802893002: Revert of Remove support for Alt-Svc/Alternate Protocol Probability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties.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 (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
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() {} 141 AlternativeServiceInfo() : alternative_service(), probability(0.0) {}
142 142
143 AlternativeServiceInfo(const AlternativeService& alternative_service, 143 AlternativeServiceInfo(const AlternativeService& alternative_service,
144 double probability,
144 base::Time expiration) 145 base::Time expiration)
145 : alternative_service(alternative_service), 146 : alternative_service(alternative_service),
147 probability(probability),
146 expiration(expiration) {} 148 expiration(expiration) {}
147 149
148 AlternativeServiceInfo(AlternateProtocol protocol, 150 AlternativeServiceInfo(AlternateProtocol protocol,
149 const std::string& host, 151 const std::string& host,
150 uint16_t port, 152 uint16_t port,
153 double probability,
151 base::Time expiration) 154 base::Time expiration)
152 : alternative_service(protocol, host, port), 155 : alternative_service(protocol, host, port),
156 probability(probability),
153 expiration(expiration) {} 157 expiration(expiration) {}
154 158
155 AlternativeServiceInfo( 159 AlternativeServiceInfo(
156 const AlternativeServiceInfo& alternative_service_info) = default; 160 const AlternativeServiceInfo& alternative_service_info) = default;
157 AlternativeServiceInfo& operator=( 161 AlternativeServiceInfo& operator=(
158 const AlternativeServiceInfo& alternative_service_info) = default; 162 const AlternativeServiceInfo& alternative_service_info) = default;
159 163
160 bool operator==(const AlternativeServiceInfo& other) const { 164 bool operator==(const AlternativeServiceInfo& other) const {
161 return alternative_service == other.alternative_service && 165 return alternative_service == other.alternative_service &&
162 expiration == other.expiration; 166 probability == other.probability && expiration == other.expiration;
163 } 167 }
164 168
165 bool operator!=(const AlternativeServiceInfo& other) const { 169 bool operator!=(const AlternativeServiceInfo& other) const {
166 return !this->operator==(other); 170 return !this->operator==(other);
167 } 171 }
168 172
169 std::string ToString() const; 173 std::string ToString() const;
170 174
171 AlternativeService alternative_service; 175 AlternativeService alternative_service;
176 double probability;
172 base::Time expiration; 177 base::Time expiration;
173 }; 178 };
174 179
175 struct NET_EXPORT SupportsQuic { 180 struct NET_EXPORT SupportsQuic {
176 SupportsQuic() : used_quic(false) {} 181 SupportsQuic() : used_quic(false) {}
177 SupportsQuic(bool used_quic, const std::string& address) 182 SupportsQuic(bool used_quic, const std::string& address)
178 : used_quic(used_quic), 183 : used_quic(used_quic),
179 address(address) {} 184 address(address) {}
180 185
181 bool Equals(const SupportsQuic& other) const { 186 bool Equals(const SupportsQuic& other) const {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // Require HTTP/1.1 on subsequent connections. Not persisted. 258 // Require HTTP/1.1 on subsequent connections. Not persisted.
254 virtual void SetHTTP11Required(const HostPortPair& server) = 0; 259 virtual void SetHTTP11Required(const HostPortPair& server) = 0;
255 260
256 // Modify SSLConfig to force HTTP/1.1. 261 // Modify SSLConfig to force HTTP/1.1.
257 static void ForceHTTP11(SSLConfig* ssl_config); 262 static void ForceHTTP11(SSLConfig* ssl_config);
258 263
259 // Modify SSLConfig to force HTTP/1.1 if necessary. 264 // Modify SSLConfig to force HTTP/1.1 if necessary.
260 virtual void MaybeForceHTTP11(const HostPortPair& server, 265 virtual void MaybeForceHTTP11(const HostPortPair& server,
261 SSLConfig* ssl_config) = 0; 266 SSLConfig* ssl_config) = 0;
262 267
263 // Return all alternative services for |origin|, including broken ones. 268 // Return all alternative services for |origin| with probability greater than
269 // or equal to the threshold, including broken ones.
264 // Returned alternative services never have empty hostnames. 270 // Returned alternative services never have empty hostnames.
265 virtual AlternativeServiceVector GetAlternativeServices( 271 virtual AlternativeServiceVector GetAlternativeServices(
266 const HostPortPair& origin) = 0; 272 const HostPortPair& origin) = 0;
267 273
268 // Set a single alternative service for |origin|. Previous alternative 274 // Set a single alternative service for |origin|. Previous alternative
269 // services for |origin| are discarded. 275 // services for |origin| are discarded.
270 // |alternative_service.host| may be empty. 276 // |alternative_service.host| may be empty.
271 // Return true if |alternative_service_map_| is changed. 277 // Return true if |alternative_service_map_| is changed.
272 virtual bool SetAlternativeService( 278 virtual bool SetAlternativeService(
273 const HostPortPair& origin, 279 const HostPortPair& origin,
274 const AlternativeService& alternative_service, 280 const AlternativeService& alternative_service,
281 double alternative_probability,
275 base::Time expiration) = 0; 282 base::Time expiration) = 0;
276 283
277 // Set alternative services for |origin|. Previous alternative services for 284 // Set alternative services for |origin|. Previous alternative services for
278 // |origin| are discarded. 285 // |origin| are discarded.
279 // Hostnames in |alternative_service_info_vector| may be empty. 286 // Hostnames in |alternative_service_info_vector| may be empty.
280 // Return true if |alternative_service_map_| is changed. 287 // Return true if |alternative_service_map_| is changed.
281 virtual bool SetAlternativeServices( 288 virtual bool SetAlternativeServices(
282 const HostPortPair& origin, 289 const HostPortPair& origin,
283 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; 290 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0;
284 291
(...skipping 26 matching lines...) Expand all
311 virtual void ClearAlternativeServices(const HostPortPair& origin) = 0; 318 virtual void ClearAlternativeServices(const HostPortPair& origin) = 0;
312 319
313 // Returns all alternative service mappings. 320 // Returns all alternative service mappings.
314 // Returned alternative services may have empty hostnames. 321 // Returned alternative services may have empty hostnames.
315 virtual const AlternativeServiceMap& alternative_service_map() const = 0; 322 virtual const AlternativeServiceMap& alternative_service_map() const = 0;
316 323
317 // Returns all alternative service mappings as human readable strings. 324 // Returns all alternative service mappings as human readable strings.
318 // Empty alternative service hostnames will be printed as such. 325 // Empty alternative service hostnames will be printed as such.
319 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0; 326 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0;
320 327
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
321 // Gets a reference to the SettingsMap stored for a host. 335 // Gets a reference to the SettingsMap stored for a host.
322 // If no settings are stored, returns an empty SettingsMap. 336 // If no settings are stored, returns an empty SettingsMap.
323 virtual const SettingsMap& GetSpdySettings( 337 virtual const SettingsMap& GetSpdySettings(
324 const HostPortPair& host_port_pair) = 0; 338 const HostPortPair& host_port_pair) = 0;
325 339
326 // Saves an individual SPDY setting for a host. Returns true if SPDY setting 340 // Saves an individual SPDY setting for a host. Returns true if SPDY setting
327 // is to be persisted. 341 // is to be persisted.
328 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, 342 virtual bool SetSpdySetting(const HostPortPair& host_port_pair,
329 SpdySettingsIds id, 343 SpdySettingsIds id,
330 SpdySettingsFlags flags, 344 SpdySettingsFlags flags,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 virtual void SetMaxServerConfigsStoredInProperties( 386 virtual void SetMaxServerConfigsStoredInProperties(
373 size_t max_server_configs_stored_in_properties) = 0; 387 size_t max_server_configs_stored_in_properties) = 0;
374 388
375 private: 389 private:
376 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); 390 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties);
377 }; 391 };
378 392
379 } // namespace net 393 } // namespace net
380 394
381 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 395 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698