diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 20:46:01 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 20:46:01 +0000 |
commit | 63bf966c829d04878c3012cd221a27f1ea44b7d8 (patch) | |
tree | 630e51035533a1592dc02bf6fb9ae66c16b00019 /net | |
parent | 736441a7a4e0dde8240d5eeca984351fb0100501 (diff) | |
download | chromium_src-63bf966c829d04878c3012cd221a27f1ea44b7d8.zip chromium_src-63bf966c829d04878c3012cd221a27f1ea44b7d8.tar.gz chromium_src-63bf966c829d04878c3012cd221a27f1ea44b7d8.tar.bz2 |
[SPDY] Add flag to turn on SPDY/3.1 (with per-session flow control)
Add SPDY/3.1 info for NPN and Alternate-Protocol.
BUG=176592
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/12388099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_transaction_spdy3_unittest.cc | 4 | ||||
-rw-r--r-- | net/http/http_server_properties.cc | 1 | ||||
-rw-r--r-- | net/http/http_server_properties.h | 1 | ||||
-rw-r--r-- | net/http/http_stream_factory.cc | 13 | ||||
-rw-r--r-- | net/http/http_stream_factory.h | 4 | ||||
-rw-r--r-- | net/socket/next_proto.h | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool.cc | 11 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_spdy3_unittest.cc | 1 |
9 files changed, 35 insertions, 8 deletions
diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index 4473ac9..51313c6 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -105,7 +105,7 @@ std::vector<std::string> MakeNextProtos(const char* a, ...) { // SpdyNextProtos returns a vector of NPN protocol strings for negotiating // SPDY. std::vector<std::string> SpdyNextProtos() { - return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", NULL); + return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", "spdy/3.1", NULL); } int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { @@ -9558,7 +9558,7 @@ TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { HttpStreamFactory::set_use_alternate_protocols(true); HttpStreamFactory::SetNextProtos( MakeNextProtos( - "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy", NULL)); + "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy/3.1", "spdy", NULL)); SpdySessionDependencies session_deps( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc index 022c8e7..34d1617 100644 --- a/net/http/http_server_properties.cc +++ b/net/http/http_server_properties.cc @@ -16,6 +16,7 @@ const char* const kAlternateProtocolStrings[] = { "npn-spdy/1", "npn-spdy/2", "npn-spdy/3", + "npn-spdy/3.1", "quic/1" }; const char kBrokenAlternateProtocol[] = "Broken"; diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h index 040763c..c4ced05 100644 --- a/net/http/http_server_properties.h +++ b/net/http/http_server_properties.h @@ -19,6 +19,7 @@ enum AlternateProtocol { NPN_SPDY_1 = 0, NPN_SPDY_2, NPN_SPDY_3, + NPN_SPDY_3_1, QUIC_1, NUM_ALTERNATE_PROTOCOLS, ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index bd30444..7b4e8c0 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc @@ -169,6 +169,17 @@ void HttpStreamFactory::EnableNpnSpdy3() { } // static +void HttpStreamFactory::EnableNpnSpdy31() { + set_use_alternate_protocols(true); + std::vector<std::string> next_protos; + next_protos.push_back("http/1.1"); + next_protos.push_back("spdy/2"); + next_protos.push_back("spdy/3"); + next_protos.push_back("spdy/3.1"); + SetNextProtos(next_protos); +} + +// static void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { if (!next_protos_) next_protos_ = new std::vector<std::string>; @@ -187,6 +198,8 @@ void HttpStreamFactory::SetNextProtos(const std::vector<std::string>& value) { enabled_protocols_[NPN_SPDY_2] = true; } else if (value[i] == "spdy/3") { enabled_protocols_[NPN_SPDY_3] = true; + } else if (value[i] == "spdy/3.1") { + enabled_protocols_[NPN_SPDY_3_1] = true; } else if (value[i] == "quic/1") { enabled_protocols_[QUIC_1] = true; } diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h index 5f6ef2f..a0355ae 100644 --- a/net/http/http_stream_factory.h +++ b/net/http/http_stream_factory.h @@ -239,6 +239,10 @@ class NET_EXPORT HttpStreamFactory { // Sets http/1.1, spdy/2, and spdy/3 as the protocols supported via NPN. static void EnableNpnSpdy3(); + // Sets http/1.1, spdy/2, spdy/3, and spdy/3.1 as the protocols + // supported via NPN. + static void EnableNpnSpdy31(); + // Sets the protocols supported by NPN (next protocol negotiation) during the // SSL handshake as well as by HTTP Alternate-Protocol. static void SetNextProtos(const std::vector<std::string>& value); diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h index a60437f..7ba3e57 100644 --- a/net/socket/next_proto.h +++ b/net/socket/next_proto.h @@ -14,11 +14,15 @@ namespace net { enum NextProto { kProtoUnknown = 0, kProtoHTTP11 = 1, + kProtoSPDY1 = 2, + kProtoSPDYMinimumVersion = kProtoSPDY1, kProtoSPDY2 = 3, kProtoSPDY21 = 4, kProtoSPDY3 = 5, kProtoSPDY31 = 6, + kProtoSPDYMaximumVersion = kProtoSPDY31, + kProtoMaximumVersion = 7, }; diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc index 7f23258..478ef18 100644 --- a/net/socket/ssl_client_socket.cc +++ b/net/socket/ssl_client_socket.cc @@ -26,6 +26,8 @@ NextProto SSLClientSocket::NextProtoFromString( return kProtoSPDY2; } else if (proto_string == "spdy/3") { return kProtoSPDY3; + } else if (proto_string == "spdy/3.1") { + return kProtoSPDY31; } else { return kProtoUnknown; } @@ -42,6 +44,8 @@ const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { return "spdy/2"; case kProtoSPDY3: return "spdy/3"; + case kProtoSPDY31: + return "spdy/3.1"; default: break; } diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 826ccc8..64ebf28 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -301,12 +301,11 @@ int SSLConnectJob::DoSSLConnectComplete(int result) { NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto); ssl_socket_->set_protocol_negotiated(protocol_negotiated); - // If we negotiated either version of SPDY, we must have - // advertised it, so allow it. - // TODO(mbelshe): verify it was a protocol we advertised? - if (protocol_negotiated == kProtoSPDY1 || - protocol_negotiated == kProtoSPDY2 || - protocol_negotiated == kProtoSPDY3) { + // If we negotiated a SPDY version, it must have been present in + // SSLConfig::next_protos. + // TODO(mbelshe): Verify this. + if (protocol_negotiated >= kProtoSPDYMinimumVersion && + protocol_negotiated <= kProtoSPDYMaximumVersion) { ssl_socket_->set_was_spdy_negotiated(true); } } diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index 5dcdefd..c46ea45 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -132,6 +132,7 @@ class SpdyNetworkTransactionSpdy3Test next_protos.push_back("http/1.1"); next_protos.push_back("spdy/2"); next_protos.push_back("spdy/3"); + next_protos.push_back("spdy/3.1"); switch (test_type_) { case SPDYNPN: |