summaryrefslogtreecommitdiffstats
path: root/net/http/http_network_transaction.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/http/http_network_transaction.cc')
-rw-r--r--net/http/http_network_transaction.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 5cc3895..a9d557f 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -163,9 +163,14 @@ void ProcessAlternateProtocol(const HttpResponseHeaders& headers,
return;
}
- if (port_protocol_vector[1] !=
- HttpAlternateProtocols::kProtocolStrings[
- HttpAlternateProtocols::NPN_SPDY_1]) {
+ HttpAlternateProtocols::Protocol protocol = HttpAlternateProtocols::BROKEN;
+ for (int i = HttpAlternateProtocols::NPN_SPDY_1;
+ i < HttpAlternateProtocols::NUM_ALTERNATE_PROTOCOLS; ++i) {
+ if (port_protocol_vector[1] == HttpAlternateProtocols::kProtocolStrings[i])
+ protocol = static_cast<HttpAlternateProtocols::Protocol>(i);
+ }
+
+ if (protocol == HttpAlternateProtocols::BROKEN) {
// Currently, we only recognize the npn-spdy protocol.
DLOG(WARNING) << HttpAlternateProtocols::kHeader
<< " header has unrecognized protocol: "
@@ -185,8 +190,7 @@ void ProcessAlternateProtocol(const HttpResponseHeaders& headers,
return;
}
- alternate_protocols->SetAlternateProtocolFor(
- host_port, port, HttpAlternateProtocols::NPN_SPDY_1);
+ alternate_protocols->SetAlternateProtocolFor(host_port, port, protocol);
}
} // namespace
@@ -663,9 +667,11 @@ int HttpNetworkTransaction::DoResolveProxy() {
HttpAlternateProtocols::PortProtocolPair alternate =
alternate_protocols.GetAlternateProtocolFor(endpoint_);
if (alternate.protocol != HttpAlternateProtocols::BROKEN) {
- DCHECK_EQ(HttpAlternateProtocols::NPN_SPDY_1, alternate.protocol);
+ DCHECK_LE(HttpAlternateProtocols::NPN_SPDY_1, alternate.protocol);
+ DCHECK_GT(HttpAlternateProtocols::NUM_ALTERNATE_PROTOCOLS,
+ alternate.protocol);
endpoint_.set_port(alternate.port);
- alternate_protocol_ = HttpAlternateProtocols::NPN_SPDY_1;
+ alternate_protocol_ = alternate.protocol;
alternate_protocol_mode_ = kUsingAlternateProtocol;
url_canon::Replacements<char> replacements;
@@ -726,7 +732,7 @@ int HttpNetworkTransaction::DoInitConnection() {
}
bool want_spdy_over_npn = alternate_protocol_mode_ == kUsingAlternateProtocol
- && alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_1;
+ && alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2;
using_ssl_ = request_->url.SchemeIs("https") ||
(want_spdy_without_npn_ && want_ssl_over_spdy_without_npn_) ||
want_spdy_over_npn;
@@ -876,7 +882,7 @@ int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
std::string proto;
ssl_socket->GetNextProto(&proto);
if (SSLClientSocket::NextProtoFromString(proto) ==
- SSLClientSocket::kProtoSPDY1)
+ SSLClientSocket::kProtoSPDY2)
using_spdy_ = true;
}
if(want_ssl_over_spdy_without_npn_ && want_spdy_without_npn_)