| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/field_trial.h" | 8 #include "base/field_trial.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 859 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
| 860 | 860 |
| 861 SSLClientSocket::NextProtoStatus status = | 861 SSLClientSocket::NextProtoStatus status = |
| 862 SSLClientSocket::kNextProtoUnsupported; | 862 SSLClientSocket::kNextProtoUnsupported; |
| 863 std::string proto; | 863 std::string proto; |
| 864 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket | 864 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket |
| 865 // that hasn't had SSL_ImportFD called on it. If we get a certificate error | 865 // that hasn't had SSL_ImportFD called on it. If we get a certificate error |
| 866 // here, then we know that we called SSL_ImportFD. | 866 // here, then we know that we called SSL_ImportFD. |
| 867 if (result == OK || IsCertificateError(result)) | 867 if (result == OK || IsCertificateError(result)) |
| 868 status = ssl_socket->GetNextProto(&proto); | 868 status = ssl_socket->GetNextProto(&proto); |
| 869 static const char kSpdyProto[] = "spdy"; | |
| 870 using_spdy_ = (status == SSLClientSocket::kNextProtoNegotiated && | 869 using_spdy_ = (status == SSLClientSocket::kNextProtoNegotiated && |
| 871 proto == kSpdyProto); | 870 SSLClientSocket::NextProtoFromString(proto) == |
| 871 SSLClientSocket::kProtoSPDY1); |
| 872 | 872 |
| 873 if (alternate_protocol_mode_ == kUsingAlternateProtocol && | 873 if (alternate_protocol_mode_ == kUsingAlternateProtocol && |
| 874 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_1 && | 874 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_1 && |
| 875 !using_spdy_) { | 875 !using_spdy_) { |
| 876 // We tried using the NPN_SPDY_1 alternate protocol, but failed, so we | 876 // We tried using the NPN_SPDY_1 alternate protocol, but failed, so we |
| 877 // fallback. | 877 // fallback. |
| 878 MarkBrokenAlternateProtocolAndFallback(); | 878 MarkBrokenAlternateProtocolAndFallback(); |
| 879 return OK; | 879 return OK; |
| 880 } | 880 } |
| 881 | 881 |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 http_host_port_pair); | 1968 http_host_port_pair); |
| 1969 | 1969 |
| 1970 alternate_protocol_mode_ = kDoNotUseAlternateProtocol; | 1970 alternate_protocol_mode_ = kDoNotUseAlternateProtocol; |
| 1971 if (connection_->socket()) | 1971 if (connection_->socket()) |
| 1972 connection_->socket()->Disconnect(); | 1972 connection_->socket()->Disconnect(); |
| 1973 connection_->Reset(); | 1973 connection_->Reset(); |
| 1974 next_state_ = STATE_INIT_CONNECTION; | 1974 next_state_ = STATE_INIT_CONNECTION; |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 } // namespace net | 1977 } // namespace net |
| OLD | NEW |