Chromium Code Reviews| Index: net/http/http_network_layer.cc |
| diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc |
| index 68bc5f841294902e50d1a12de3c39ec93fa108dd..d12bccc926ab1c727476e1909f1853505f46a5e3 100644 |
| --- a/net/http/http_network_layer.cc |
| +++ b/net/http/http_network_layer.cc |
| @@ -64,18 +64,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. |
|
wtc
2011/10/11 23:43:04
Nit: it seems useful to preserve this comment in t
agl
2011/10/17 17:37:24
Done.
|
| - static const char kNpnProtosFullV1[] = "\x08http/1.1\x06spdy/1"; |
| - // No spdy specified. |
| - static const char kNpnProtosHttpOnly[] = "\x08http/1.1\x07http1.1"; |
| - |
| std::vector<std::string> spdy_options; |
| base::SplitString(mode, ',', &spdy_options); |
| @@ -104,15 +92,24 @@ 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; |
| + 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); |