| 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_STREAM_FACTORY_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_H_ |
| 6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 public: | 59 public: |
| 60 virtual ~Delegate() {} | 60 virtual ~Delegate() {} |
| 61 | 61 |
| 62 // This is the success case for RequestStream. | 62 // This is the success case for RequestStream. |
| 63 // |stream| is now owned by the delegate. | 63 // |stream| is now owned by the delegate. |
| 64 // |used_ssl_config| indicates the actual SSL configuration used for this | 64 // |used_ssl_config| indicates the actual SSL configuration used for this |
| 65 // stream, since the HttpStreamRequest may have modified the configuration | 65 // stream, since the HttpStreamRequest may have modified the configuration |
| 66 // during stream processing. | 66 // during stream processing. |
| 67 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, | 67 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
| 68 // since the HttpStreamRequest performs the proxy resolution. | 68 // since the HttpStreamRequest performs the proxy resolution. |
| 69 virtual void OnStreamReady( | 69 virtual void OnStreamReady(const SSLConfig& used_ssl_config, |
| 70 const SSLConfig& used_ssl_config, | 70 const ProxyInfo& used_proxy_info, |
| 71 const ProxyInfo& used_proxy_info, | 71 HttpStreamBase* stream) = 0; |
| 72 HttpStreamBase* stream) = 0; | |
| 73 | 72 |
| 74 // This is the success case for RequestWebSocketHandshakeStream. | 73 // This is the success case for RequestWebSocketHandshakeStream. |
| 75 // |stream| is now owned by the delegate. | 74 // |stream| is now owned by the delegate. |
| 76 // |used_ssl_config| indicates the actual SSL configuration used for this | 75 // |used_ssl_config| indicates the actual SSL configuration used for this |
| 77 // stream, since the HttpStreamRequest may have modified the configuration | 76 // stream, since the HttpStreamRequest may have modified the configuration |
| 78 // during stream processing. | 77 // during stream processing. |
| 79 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, | 78 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, |
| 80 // since the HttpStreamRequest performs the proxy resolution. | 79 // since the HttpStreamRequest performs the proxy resolution. |
| 81 virtual void OnWebSocketHandshakeStreamReady( | 80 virtual void OnWebSocketHandshakeStreamReady( |
| 82 const SSLConfig& used_ssl_config, | 81 const SSLConfig& used_ssl_config, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Controls whether or not we use the Alternate-Protocol header. | 240 // Controls whether or not we use the Alternate-Protocol header. |
| 242 static void set_use_alternate_protocols(bool value) { | 241 static void set_use_alternate_protocols(bool value) { |
| 243 use_alternate_protocols_ = value; | 242 use_alternate_protocols_ = value; |
| 244 } | 243 } |
| 245 static bool use_alternate_protocols() { return use_alternate_protocols_; } | 244 static bool use_alternate_protocols() { return use_alternate_protocols_; } |
| 246 | 245 |
| 247 // Controls whether or not we use ssl when in spdy mode. | 246 // Controls whether or not we use ssl when in spdy mode. |
| 248 static void set_force_spdy_over_ssl(bool value) { | 247 static void set_force_spdy_over_ssl(bool value) { |
| 249 force_spdy_over_ssl_ = value; | 248 force_spdy_over_ssl_ = value; |
| 250 } | 249 } |
| 251 static bool force_spdy_over_ssl() { | 250 static bool force_spdy_over_ssl() { return force_spdy_over_ssl_; } |
| 252 return force_spdy_over_ssl_; | |
| 253 } | |
| 254 | 251 |
| 255 // Controls whether or not we use spdy without npn. | 252 // Controls whether or not we use spdy without npn. |
| 256 static void set_force_spdy_always(bool value) { | 253 static void set_force_spdy_always(bool value) { force_spdy_always_ = value; } |
| 257 force_spdy_always_ = value; | |
| 258 } | |
| 259 static bool force_spdy_always() { return force_spdy_always_; } | 254 static bool force_spdy_always() { return force_spdy_always_; } |
| 260 | 255 |
| 261 // Add a URL to exclude from forced SPDY. | 256 // Add a URL to exclude from forced SPDY. |
| 262 static void add_forced_spdy_exclusion(const std::string& value); | 257 static void add_forced_spdy_exclusion(const std::string& value); |
| 263 // Check if a HostPortPair is excluded from using spdy. | 258 // Check if a HostPortPair is excluded from using spdy. |
| 264 static bool HasSpdyExclusion(const HostPortPair& endpoint); | 259 static bool HasSpdyExclusion(const HostPortPair& endpoint); |
| 265 | 260 |
| 266 // Sets http/1.1 as the only protocol supported via NPN or Alternate-Protocol. | 261 // Sets http/1.1 as the only protocol supported via NPN or Alternate-Protocol. |
| 267 static void EnableNpnHttpOnly(); | 262 static void EnableNpnHttpOnly(); |
| 268 | 263 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 279 static void EnableNpnSpdy31WithSpdy2(); | 274 static void EnableNpnSpdy31WithSpdy2(); |
| 280 | 275 |
| 281 // Sets http/1.1, quic, spdy/3, spdy/3.1, and spdy/4 (http/2) as the | 276 // Sets http/1.1, quic, spdy/3, spdy/3.1, and spdy/4 (http/2) as the |
| 282 // protocols supported via NPN or Alternate-Protocol. | 277 // protocols supported via NPN or Alternate-Protocol. |
| 283 static void EnableNpnSpdy4Http2(); | 278 static void EnableNpnSpdy4Http2(); |
| 284 | 279 |
| 285 // Sets the protocols supported by NPN (next protocol negotiation) during the | 280 // Sets the protocols supported by NPN (next protocol negotiation) during the |
| 286 // SSL handshake as well as by HTTP Alternate-Protocol. | 281 // SSL handshake as well as by HTTP Alternate-Protocol. |
| 287 static void SetNextProtos(const std::vector<NextProto>& value); | 282 static void SetNextProtos(const std::vector<NextProto>& value); |
| 288 static bool has_next_protos() { return next_protos_ != NULL; } | 283 static bool has_next_protos() { return next_protos_ != NULL; } |
| 289 static const std::vector<std::string>& next_protos() { | 284 static const std::vector<std::string>& next_protos() { return *next_protos_; } |
| 290 return *next_protos_; | |
| 291 } | |
| 292 | 285 |
| 293 protected: | 286 protected: |
| 294 HttpStreamFactory(); | 287 HttpStreamFactory(); |
| 295 | 288 |
| 296 private: | 289 private: |
| 297 // |protocol| must be a valid protocol value. | 290 // |protocol| must be a valid protocol value. |
| 298 static bool IsProtocolEnabled(AlternateProtocol protocol); | 291 static bool IsProtocolEnabled(AlternateProtocol protocol); |
| 299 static void SetProtocolEnabled(AlternateProtocol protocol); | 292 static void SetProtocolEnabled(AlternateProtocol protocol); |
| 300 static void ResetEnabledProtocols(); | 293 static void ResetEnabledProtocols(); |
| 301 | 294 |
| 302 static std::vector<std::string>* next_protos_; | 295 static std::vector<std::string>* next_protos_; |
| 303 static bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS]; | 296 static bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS]; |
| 304 static bool spdy_enabled_; | 297 static bool spdy_enabled_; |
| 305 static bool use_alternate_protocols_; | 298 static bool use_alternate_protocols_; |
| 306 static bool force_spdy_over_ssl_; | 299 static bool force_spdy_over_ssl_; |
| 307 static bool force_spdy_always_; | 300 static bool force_spdy_always_; |
| 308 static std::list<HostPortPair>* forced_spdy_exclusions_; | 301 static std::list<HostPortPair>* forced_spdy_exclusions_; |
| 309 | 302 |
| 310 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); | 303 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); |
| 311 }; | 304 }; |
| 312 | 305 |
| 313 } // namespace net | 306 } // namespace net |
| 314 | 307 |
| 315 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ | 308 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ |
| OLD | NEW |