diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 21:39:26 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 21:39:26 +0000 |
commit | 87f64d0a3a65d18ad5360e9326e303079bab2fb0 (patch) | |
tree | 47428ed5c192b0d539981c447d5013ac72e74cae /net | |
parent | 6fe3a50a9165ad5ef722c82749ec6cfc0d1f26cc (diff) | |
download | chromium_src-87f64d0a3a65d18ad5360e9326e303079bab2fb0.zip chromium_src-87f64d0a3a65d18ad5360e9326e303079bab2fb0.tar.gz chromium_src-87f64d0a3a65d18ad5360e9326e303079bab2fb0.tar.bz2 |
SPDY: Change Chrome code to support new NPN protocols.
Review URL: http://codereview.chromium.org/1575048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_layer.cc | 9 | ||||
-rw-r--r-- | net/http/http_network_transaction.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket.h | 8 |
3 files changed, 14 insertions, 7 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index 8a22514..4915cd1 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -136,7 +136,14 @@ void HttpNetworkLayer::EnableSpdy(const std::string& mode) { } else if (option == kDisableCompression) { spdy::SpdyFramer::set_enable_compression_default(false); } else if (option == kEnableNPN) { - HttpNetworkTransaction::SetNextProtos("\007http1.1\004spdy"); + // 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. + HttpNetworkTransaction::SetNextProtos( + "\008http/1.1\007http1.1\006spdy/1\004spdy"); force_spdy_ = false; } else if (option.empty() && it == spdy_options.begin()) { continue; diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 9c4d0f9..0144316 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -870,9 +870,9 @@ int HttpNetworkTransaction::DoSSLConnectComplete(int result) { // here, then we know that we called SSL_ImportFD. if (result == OK || IsCertificateError(result)) status = ssl_socket->GetNextProto(&proto); - static const char kSpdyProto[] = "spdy"; using_spdy_ = (status == SSLClientSocket::kNextProtoNegotiated && - proto == kSpdyProto); + SSLClientSocket::NextProtoFromString(proto) == + SSLClientSocket::kProtoSPDY1); if (alternate_protocol_mode_ == kUsingAlternateProtocol && alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_1 && diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index f592a1b..77537ea 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h @@ -39,7 +39,7 @@ class SSLClientSocket : public ClientSocket { enum NextProto { kProtoUnknown = 0, kProtoHTTP11 = 1, - kProtoSPDY = 2, + kProtoSPDY1 = 2, }; // Gets the SSL connection information of the socket. @@ -60,10 +60,10 @@ class SSLClientSocket : public ClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto) = 0; static NextProto NextProtoFromString(const std::string& proto_string) { - if (proto_string == "http1.1") { + if (proto_string == "http1.1" || proto_string == "http/1.1") { return kProtoHTTP11; - } else if (proto_string == "spdy") { - return kProtoSPDY; + } else if (proto_string == "spdy" || proto_string == "spdy/1") { + return kProtoSPDY1; } else { return kProtoUnknown; } |