Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: net/http/http_network_layer.cc

Issue 8156001: net: rework the NPN patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_network_layer.cc
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 63cd287e5fda08d46b5e29addfb7b868c2956eb1..0ff32d629300fd186ca7dc8ca9d51c4bdb308710 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);

Powered by Google App Engine
This is Rietveld 408576698