Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 519048: SSL: remove NOTREACHED from GetNextProto error path. (Closed)
Patch Set: ... Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/field_trial.h" 10 #include "base/field_trial.h"
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 ClientSocket* s = connection_->release_socket(); 792 ClientSocket* s = connection_->release_socket();
793 s = session_->socket_factory()->CreateSSLClientSocket( 793 s = session_->socket_factory()->CreateSSLClientSocket(
794 s, request_->url.HostNoBrackets(), ssl_config_); 794 s, request_->url.HostNoBrackets(), ssl_config_);
795 connection_->set_socket(s); 795 connection_->set_socket(s);
796 return connection_->socket()->Connect(&io_callback_, load_log_); 796 return connection_->socket()->Connect(&io_callback_, load_log_);
797 } 797 }
798 798
799 int HttpNetworkTransaction::DoSSLConnectComplete(int result) { 799 int HttpNetworkTransaction::DoSSLConnectComplete(int result) {
800 SSLClientSocket* ssl_socket = 800 SSLClientSocket* ssl_socket =
801 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 801 reinterpret_cast<SSLClientSocket*>(connection_->socket());
802
803 SSLClientSocket::NextProtoStatus status =
804 SSLClientSocket::kNextProtoUnsupported;
802 std::string proto; 805 std::string proto;
803 SSLClientSocket::NextProtoStatus status = ssl_socket->GetNextProto(&proto); 806 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket
807 // that hasn't had SSL_ImportFD called on it. If we get a certificate error
808 // here, then we know that we called SSL_ImportFD.
809 if (result == OK || IsCertificateError(result))
810 status = ssl_socket->GetNextProto(&proto);
804 static const char kSpdyProto[] = "spdy"; 811 static const char kSpdyProto[] = "spdy";
805 const bool use_spdy = (status != SSLClientSocket::kNextProtoUnsupported && 812 const bool use_spdy = (status == SSLClientSocket::kNextProtoNegotiated &&
806 proto == kSpdyProto); 813 proto == kSpdyProto);
807 814
808 if (IsCertificateError(result)) { 815 if (IsCertificateError(result)) {
809 if (use_spdy) { 816 if (use_spdy) {
810 // We currently ignore certificate errors for spdy. 817 // We currently ignore certificate errors for spdy.
wtc 2010/01/11 23:55:49 Could you add a TODO comment here so we remember t
811 result = OK; 818 result = OK;
812 } else { 819 } else {
813 result = HandleCertificateError(result); 820 result = HandleCertificateError(result);
814 } 821 }
815 } 822 }
816 823
817 if (result == OK) { 824 if (result == OK) {
818 DCHECK(ssl_connect_start_time_ != base::TimeTicks()); 825 DCHECK(ssl_connect_start_time_ != base::TimeTicks());
819 base::TimeDelta connect_duration = 826 base::TimeDelta connect_duration =
820 base::TimeTicks::Now() - ssl_connect_start_time_; 827 base::TimeTicks::Now() - ssl_connect_start_time_;
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 AuthChallengeInfo* auth_info = new AuthChallengeInfo; 1873 AuthChallengeInfo* auth_info = new AuthChallengeInfo;
1867 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; 1874 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY;
1868 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); 1875 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin));
1869 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); 1876 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme());
1870 // TODO(eroman): decode realm according to RFC 2047. 1877 // TODO(eroman): decode realm according to RFC 2047.
1871 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); 1878 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm());
1872 response_.auth_challenge = auth_info; 1879 response_.auth_challenge = auth_info;
1873 } 1880 }
1874 1881
1875 } // namespace net 1882 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698