| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/http/http_network_layer.h" | 5 #include "net/http/http_network_layer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DCHECK(session); | 35 DCHECK(session); |
| 36 | 36 |
| 37 return new HttpNetworkLayer(session); | 37 return new HttpNetworkLayer(session); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 void HttpNetworkLayer::EnableSpdy(const std::string& mode) { | 41 void HttpNetworkLayer::EnableSpdy(const std::string& mode) { |
| 42 static const char kOff[] = "off"; | 42 static const char kOff[] = "off"; |
| 43 static const char kSSL[] = "ssl"; | 43 static const char kSSL[] = "ssl"; |
| 44 static const char kDisableSSL[] = "no-ssl"; | 44 static const char kDisableSSL[] = "no-ssl"; |
| 45 static const char kDisablePing[] = "no-ping"; |
| 45 static const char kExclude[] = "exclude"; // Hosts to exclude | 46 static const char kExclude[] = "exclude"; // Hosts to exclude |
| 46 static const char kDisableCompression[] = "no-compress"; | 47 static const char kDisableCompression[] = "no-compress"; |
| 47 static const char kDisableAltProtocols[] = "no-alt-protocols"; | 48 static const char kDisableAltProtocols[] = "no-alt-protocols"; |
| 48 static const char kEnableVersionOne[] = "v1"; | 49 static const char kEnableVersionOne[] = "v1"; |
| 49 static const char kForceAltProtocols[] = "force-alt-protocols"; | 50 static const char kForceAltProtocols[] = "force-alt-protocols"; |
| 50 static const char kSingleDomain[] = "single-domain"; | 51 static const char kSingleDomain[] = "single-domain"; |
| 51 | 52 |
| 52 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS | 53 // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS |
| 53 // messages are processed and outstanding window size is actually obeyed | 54 // messages are processed and outstanding window size is actually obeyed |
| 54 // when sending data frames, and WINDOW_UPDATE messages are generated | 55 // when sending data frames, and WINDOW_UPDATE messages are generated |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 if (option == kOff) { | 96 if (option == kOff) { |
| 96 HttpStreamFactory::set_spdy_enabled(false); | 97 HttpStreamFactory::set_spdy_enabled(false); |
| 97 } else if (option == kDisableSSL) { | 98 } else if (option == kDisableSSL) { |
| 98 SpdySession::SetSSLMode(false); // Disable SSL | 99 SpdySession::SetSSLMode(false); // Disable SSL |
| 99 HttpStreamFactory::set_force_spdy_over_ssl(false); | 100 HttpStreamFactory::set_force_spdy_over_ssl(false); |
| 100 HttpStreamFactory::set_force_spdy_always(true); | 101 HttpStreamFactory::set_force_spdy_always(true); |
| 101 } else if (option == kSSL) { | 102 } else if (option == kSSL) { |
| 102 HttpStreamFactory::set_force_spdy_over_ssl(true); | 103 HttpStreamFactory::set_force_spdy_over_ssl(true); |
| 103 HttpStreamFactory::set_force_spdy_always(true); | 104 HttpStreamFactory::set_force_spdy_always(true); |
| 105 } else if (option == kDisablePing) { |
| 106 SpdySession::set_enable_ping_based_connection_checking(false); |
| 104 } else if (option == kExclude) { | 107 } else if (option == kExclude) { |
| 105 HttpStreamFactory::add_forced_spdy_exclusion(value); | 108 HttpStreamFactory::add_forced_spdy_exclusion(value); |
| 106 } else if (option == kDisableCompression) { | 109 } else if (option == kDisableCompression) { |
| 107 spdy::SpdyFramer::set_enable_compression_default(false); | 110 spdy::SpdyFramer::set_enable_compression_default(false); |
| 108 } else if (option == kEnableNPN) { | 111 } else if (option == kEnableNPN) { |
| 109 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols); | 112 HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols); |
| 110 HttpStreamFactory::set_next_protos(kNpnProtosFull); | 113 HttpStreamFactory::set_next_protos(kNpnProtosFull); |
| 111 } else if (option == kEnableNpnHttpOnly) { | 114 } else if (option == kEnableNpnHttpOnly) { |
| 112 // Avoid alternate protocol in this case. Otherwise, browser will try SSL | 115 // Avoid alternate protocol in this case. Otherwise, browser will try SSL |
| 113 // and then fallback to http. This introduces extra load. | 116 // and then fallback to http. This introduces extra load. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 167 |
| 165 if (session_) | 168 if (session_) |
| 166 session_->CloseIdleConnections(); | 169 session_->CloseIdleConnections(); |
| 167 } | 170 } |
| 168 | 171 |
| 169 void HttpNetworkLayer::OnResume() { | 172 void HttpNetworkLayer::OnResume() { |
| 170 suspended_ = false; | 173 suspended_ = false; |
| 171 } | 174 } |
| 172 | 175 |
| 173 } // namespace net | 176 } // namespace net |
| OLD | NEW |