summaryrefslogtreecommitdiffstats
path: root/net/http/http_network_layer.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 23:14:14 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 23:14:14 +0000
commit85c0ed8299a1c029964ed58082e6d94a32d4dd9b (patch)
tree9b8ee6b9c9a8240f9fbe58adc96fa379ab856b76 /net/http/http_network_layer.cc
parentb7a12f7cfbace2b35037aac28d71b1a5159cad7e (diff)
downloadchromium_src-85c0ed8299a1c029964ed58082e6d94a32d4dd9b.zip
chromium_src-85c0ed8299a1c029964ed58082e6d94a32d4dd9b.tar.gz
chromium_src-85c0ed8299a1c029964ed58082e6d94a32d4dd9b.tar.bz2
Flip: Comma delimit the various flip options. Redo the fixed testing server flags.
Renames --testing-fixed-server to --testing-fixed-host. Adds --testing-fixed-http-port and --testing-fixed-https-port. Review URL: http://codereview.chromium.org/501032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_network_layer.cc')
-rw-r--r--net/http/http_network_layer.cc44
1 files changed, 28 insertions, 16 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 74cd548..fd8377b 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -5,6 +5,7 @@
#include "net/http/http_network_layer.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "net/flip/flip_framer.h"
#include "net/flip/flip_network_transaction.h"
#include "net/flip/flip_session.h"
@@ -37,7 +38,7 @@ HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
}
//-----------------------------------------------------------------------------
-bool HttpNetworkLayer::enable_flip_ = false;
+bool HttpNetworkLayer::force_flip_ = false;
HttpNetworkLayer::HttpNetworkLayer(ClientSocketFactory* socket_factory,
HostResolver* host_resolver,
@@ -70,7 +71,7 @@ int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
if (suspended_)
return ERR_NETWORK_IO_SUSPENDED;
- if (enable_flip_)
+ if (force_flip_)
trans->reset(new FlipNetworkTransaction(GetSession()));
else
trans->reset(new HttpNetworkTransaction(GetSession()));
@@ -91,7 +92,7 @@ void HttpNetworkLayer::Suspend(bool suspend) {
HttpNetworkSession* HttpNetworkLayer::GetSession() {
if (!session_) {
DCHECK(proxy_service_);
- FlipSessionPool* flip_pool = enable_flip_ ? new FlipSessionPool : NULL;
+ FlipSessionPool* flip_pool = new FlipSessionPool;
session_ = new HttpNetworkSession(
host_resolver_, proxy_service_, socket_factory_,
ssl_config_service_, flip_pool);
@@ -105,20 +106,31 @@ HttpNetworkSession* HttpNetworkLayer::GetSession() {
// static
void HttpNetworkLayer::EnableFlip(const std::string& mode) {
- static const std::string kDisableSSL("no-ssl");
- static const std::string kDisableCompression("no-compress");
- static const std::string kDisableEverything("no-ssl-no-compress");
-
- // Enable flip mode.
- enable_flip_ = true;
-
- // Disable SSL
- if (mode == kDisableEverything || mode == kDisableSSL)
- FlipSession::SetSSLMode(false);
+ static const char kDisableSSL[] = "no-ssl";
+ static const char kDisableCompression[] = "no-compress";
+
+ std::vector<std::string> flip_options;
+ SplitString(mode, ',', &flip_options);
+
+ // Force flip mode (use FlipNetworkTransaction for all http requests).
+ force_flip_ = true;
+
+ for (std::vector<std::string>::iterator it = flip_options.begin();
+ it != flip_options.end(); ++it) {
+ const std::string& option = *it;
+
+ // Disable SSL
+ if (option == kDisableSSL) {
+ FlipSession::SetSSLMode(false);
+ } else if (option == kDisableCompression) {
+ flip::FlipFramer::set_enable_compression_default(false);
+ } else if (option.empty() && it == flip_options.begin()) {
+ continue;
+ } else {
+ LOG(DFATAL) << "Unrecognized flip option: " << option;
+ }
+ }
- // Disable compression
- if (mode == kDisableEverything || mode == kDisableCompression)
- flip::FlipFramer::set_enable_compression_default(false);
}
} // namespace net