| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/containers/mru_cache.h" | 11 #include "base/containers/mru_cache.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 16 #include "net/quic/quic_bandwidth.h" | 16 #include "net/quic/quic_bandwidth.h" |
| 17 #include "net/socket/next_proto.h" | 17 #include "net/socket/next_proto.h" |
| 18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
| 19 #include "net/spdy/spdy_protocol.h" | 19 #include "net/spdy/spdy_protocol.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 struct SSLConfig; |
| 24 |
| 23 enum AlternateProtocolUsage { | 25 enum AlternateProtocolUsage { |
| 24 // Alternate Protocol was used without racing a normal connection. | 26 // Alternate Protocol was used without racing a normal connection. |
| 25 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, | 27 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, |
| 26 // Alternate Protocol was used by winning a race with a normal connection. | 28 // Alternate Protocol was used by winning a race with a normal connection. |
| 27 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, | 29 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, |
| 28 // Alternate Protocol was not used by losing a race with a normal connection. | 30 // Alternate Protocol was not used by losing a race with a normal connection. |
| 29 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, | 31 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, |
| 30 // Alternate Protocol was not used because no Alternate-Protocol information | 32 // Alternate Protocol was not used because no Alternate-Protocol information |
| 31 // was available when the request was issued, but an Alternate-Protocol header | 33 // was available when the request was issued, but an Alternate-Protocol header |
| 32 // was present in the response. | 34 // was present in the response. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 virtual void Clear() = 0; | 163 virtual void Clear() = 0; |
| 162 | 164 |
| 163 // Returns true if |server| supports SPDY. | 165 // Returns true if |server| supports SPDY. |
| 164 virtual bool SupportsSpdy(const HostPortPair& server) = 0; | 166 virtual bool SupportsSpdy(const HostPortPair& server) = 0; |
| 165 | 167 |
| 166 // Add |server| into the persistent store. Should only be called from IO | 168 // Add |server| into the persistent store. Should only be called from IO |
| 167 // thread. | 169 // thread. |
| 168 virtual void SetSupportsSpdy(const HostPortPair& server, | 170 virtual void SetSupportsSpdy(const HostPortPair& server, |
| 169 bool support_spdy) = 0; | 171 bool support_spdy) = 0; |
| 170 | 172 |
| 173 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. |
| 174 virtual bool RequiresHTTP11(const HostPortPair& server) = 0; |
| 175 |
| 176 // Require HTTP/1.1 on subsequent connections. Not persisted. |
| 177 virtual void SetHTTP11Required(const HostPortPair& server) = 0; |
| 178 |
| 179 // Modify SSLConfig to force HTTP/1.1. |
| 180 static void ForceHTTP11(SSLConfig* ssl_config); |
| 181 |
| 182 // Modify SSLConfig to force HTTP/1.1 if necessary. |
| 183 virtual void MaybeForceHTTP11(const HostPortPair& server, |
| 184 SSLConfig* ssl_config) = 0; |
| 185 |
| 171 // Returns true if |server| has an Alternate-Protocol header. | 186 // Returns true if |server| has an Alternate-Protocol header. |
| 172 virtual bool HasAlternateProtocol(const HostPortPair& server) = 0; | 187 virtual bool HasAlternateProtocol(const HostPortPair& server) = 0; |
| 173 | 188 |
| 174 // Returns the Alternate-Protocol and port for |server|. | 189 // Returns the Alternate-Protocol and port for |server|. |
| 175 // HasAlternateProtocol(server) must be true. | 190 // HasAlternateProtocol(server) must be true. |
| 176 virtual AlternateProtocolInfo GetAlternateProtocol( | 191 virtual AlternateProtocolInfo GetAlternateProtocol( |
| 177 const HostPortPair& server) = 0; | 192 const HostPortPair& server) = 0; |
| 178 | 193 |
| 179 // Sets the Alternate-Protocol for |server|. | 194 // Sets the Alternate-Protocol for |server|. |
| 180 virtual void SetAlternateProtocol(const HostPortPair& server, | 195 virtual void SetAlternateProtocol(const HostPortPair& server, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 260 |
| 246 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 261 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
| 247 | 262 |
| 248 private: | 263 private: |
| 249 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 264 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 250 }; | 265 }; |
| 251 | 266 |
| 252 } // namespace net | 267 } // namespace net |
| 253 | 268 |
| 254 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 269 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |