diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 00:54:53 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 00:54:53 +0000 |
commit | cd7569dbe7982f5102198ee4b66345896808d0ce (patch) | |
tree | e98d52ab33956eaeb37710ea582da8ea67821fce /net/tools | |
parent | 4eac30d0c89017fca0b00fdc037a39ed1fb6bf54 (diff) | |
download | chromium_src-cd7569dbe7982f5102198ee4b66345896808d0ce.zip chromium_src-cd7569dbe7982f5102198ee4b66345896808d0ce.tar.gz chromium_src-cd7569dbe7982f5102198ee4b66345896808d0ce.tar.bz2 |
Add a flag to the in-memory-server to force SPDY even if SSL-NPN didn't
negotiate it. This is used for debugging.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6291004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/flip_server/flip_in_mem_edsm_server.cc | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index de1a599..d439cfe 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -85,6 +85,9 @@ bool FLAGS_need_to_encode_url = false; // SO_REUSEPORT); bool FLAGS_reuseport = false; +// Flag to force spdy, even if NPN is not negotiated. +bool FLAGS_force_spdy = false; + // The amount of time the server delays before sending back the // reply); double FLAGS_server_think_time_in_s = 0; @@ -1150,24 +1153,31 @@ class SMConnection: public SMConnectionInterface, } else { VLOG(1) << "Session status: resumed"; } - const unsigned char *npn_proto; - unsigned int npn_proto_len; - SSL_get0_next_proto_negotiated(ssl_, &npn_proto, &npn_proto_len); - if (npn_proto_len > 0) { - string npn_proto_str((const char *)npn_proto, npn_proto_len); - VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT - << "NPN protocol detected: " << npn_proto_str; - } else { - VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT - << "NPN protocol detected: none"; - if (acceptor_->flip_handler_type_ == FLIP_HANDLER_SPDY_SERVER) { + bool spdy_negotiated = FLAGS_force_spdy; + if (!spdy_negotiated) { + const unsigned char *npn_proto; + unsigned int npn_proto_len; + SSL_get0_next_proto_negotiated(ssl_, &npn_proto, &npn_proto_len); + if (npn_proto_len > 0) { + string npn_proto_str((const char *)npn_proto, npn_proto_len); VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT - << "NPN protocol: Could not negotiate SPDY protocol."; - goto error_or_close; + << "NPN protocol detected: " << npn_proto_str; + } else { + VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT + << "NPN protocol detected: none"; + if (acceptor_->flip_handler_type_ == FLIP_HANDLER_SPDY_SERVER) { + VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT + << "NPN protocol: Could not negotiate SPDY protocol."; + goto error_or_close; + } + } + if (npn_proto_len > 0 && + !strncmp(reinterpret_cast<const char*>(npn_proto), + "spdy/2", npn_proto_len)) { + spdy_negotiated = true; } } - if (npn_proto_len > 0 && - !strncmp((char *)npn_proto, "spdy/2", npn_proto_len)) { + if (spdy_negotiated) { if (!sm_spdy_interface_) { sm_spdy_interface_ = NewSpdySM(this, NULL, epoll_server_, memory_cache_, acceptor_); @@ -3086,6 +3096,9 @@ int main (int argc, char**argv) g_proxy_config.ssl_disable_compression_ = true; } + if (cl.HasSwitch("force_spdy")) + FLAGS_force_spdy = true; + InitLogging(g_proxy_config.log_filename_.c_str(), g_proxy_config.log_destination_, logging::DONT_LOCK_LOG_FILE, @@ -3104,6 +3117,8 @@ int main (int argc, char**argv) LOG(INFO) << "Disable nagle : " << (FLAGS_disable_nagle?"true":"false"); LOG(INFO) << "Reuseport : " << (FLAGS_reuseport?"true":"false"); + LOG(INFO) << "Force SPDY : " + << (FLAGS_force_spdy?"true":"false"); LOG(INFO) << "SSL session expiry : " << g_proxy_config.ssl_session_expiry_; LOG(INFO) << "SSL disable compression : " |