summaryrefslogtreecommitdiffstats
path: root/net/http/http_network_layer.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 18:56:34 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 18:56:34 +0000
commit5285d9763b1680e6344425ec29e3c92e8bfc9b3d (patch)
treefa0d67ea7578fb6c7ee34e644222b5d2cf768e55 /net/http/http_network_layer.cc
parentc6e6617d80159e7c1dbf00ebf44f82b52f89f4ff (diff)
downloadchromium_src-5285d9763b1680e6344425ec29e3c92e8bfc9b3d.zip
chromium_src-5285d9763b1680e6344425ec29e3c92e8bfc9b3d.tar.gz
chromium_src-5285d9763b1680e6344425ec29e3c92e8bfc9b3d.tar.bz2
net: rework the NPN patch.
This change moves the protocol selection logic out of NSS and into Chromium code. This allows some things to be a little cleaner (no more wire-encoded NPN strings) and also allows for some tricks that we have been considering for SPDY+WebSockets. As a consequence of this change, next protocols are now a std::vector<std::string> rather than an encoded char* BUG=none TEST=SPDY still works with Google sites. Review URL: http://codereview.chromium.org/8156001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_network_layer.cc')
-rw-r--r--net/http/http_network_layer.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 63cd287..0ff32d6 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -66,18 +66,6 @@ void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
static const char kEnableNPN[] = "npn";
static const char kEnableNpnHttpOnly[] = "npn-http";
- // Except for the first element, the order is irrelevant. First element
- // specifies the fallback in case nothing matches
- // (SSLClientSocket::kNextProtoNoOverlap). Otherwise, the SSL library
- // will choose the first overlapping protocol in the server's list, since
- // it presumedly has a better understanding of which protocol we should
- // use, therefore the rest of the ordering here is not important.
- static const char kNpnProtosFull[] = "\x08http/1.1\x06spdy/2";
- // This is a temporary hack to pretend we support version 1.
- static const char kNpnProtosFullV1[] = "\x08http/1.1\x06spdy/1";
- // No spdy specified.
- static const char kNpnProtosHttpOnly[] = "\x08http/1.1\x07http1.1";
-
static const char kInitialMaxConcurrentStreams[] = "init-max-streams";
std::vector<std::string> spdy_options;
@@ -110,15 +98,25 @@ void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
spdy::SpdyFramer::set_enable_compression_default(false);
} else if (option == kEnableNPN) {
HttpStreamFactory::set_use_alternate_protocols(use_alt_protocols);
- HttpStreamFactory::set_next_protos(kNpnProtosFull);
+ std::vector<std::string> next_protos;
+ next_protos.push_back("http/1.1");
+ next_protos.push_back("spdy/2");
+ HttpStreamFactory::set_next_protos(next_protos);
} else if (option == kEnableNpnHttpOnly) {
// Avoid alternate protocol in this case. Otherwise, browser will try SSL
// and then fallback to http. This introduces extra load.
HttpStreamFactory::set_use_alternate_protocols(false);
- HttpStreamFactory::set_next_protos(kNpnProtosHttpOnly);
+ std::vector<std::string> next_protos;
+ next_protos.push_back("http/1.1");
+ next_protos.push_back("http1.1");
+ HttpStreamFactory::set_next_protos(next_protos);
} else if (option == kEnableVersionOne) {
spdy::SpdyFramer::set_protocol_version(1);
- HttpStreamFactory::set_next_protos(kNpnProtosFullV1);
+ std::vector<std::string> next_protos;
+ // This is a temporary hack to pretend we support version 1.
+ next_protos.push_back("http/1.1");
+ next_protos.push_back("spdy/1");
+ HttpStreamFactory::set_next_protos(next_protos);
} else if (option == kDisableAltProtocols) {
use_alt_protocols = false;
HttpStreamFactory::set_use_alternate_protocols(false);