| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should | 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should |
| 6 // think about ways to share code, if possible. | 6 // think about ways to share code, if possible. |
| 7 | 7 |
| 8 #include "net/socket_stream/socket_stream.h" | 8 #include "net/socket_stream/socket_stream.h" |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1294 |
| 1295 next_state_ = STATE_TCP_CONNECT; | 1295 next_state_ = STATE_TCP_CONNECT; |
| 1296 DoLoop(OK); | 1296 DoLoop(OK); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 int SocketStream::HandleCertificateError(int result) { | 1299 int SocketStream::HandleCertificateError(int result) { |
| 1300 DCHECK(IsCertificateError(result)); | 1300 DCHECK(IsCertificateError(result)); |
| 1301 SSLClientSocket* ssl_socket = static_cast<SSLClientSocket*>(socket_.get()); | 1301 SSLClientSocket* ssl_socket = static_cast<SSLClientSocket*>(socket_.get()); |
| 1302 DCHECK(ssl_socket); | 1302 DCHECK(ssl_socket); |
| 1303 | 1303 |
| 1304 if (HttpStreamFactory::ignore_certificate_errors() && | 1304 if (SSLClientSocket::IgnoreCertError(result, LOAD_IGNORE_ALL_CERT_ERRORS)) { |
| 1305 ssl_socket->IgnoreCertError(result, LOAD_IGNORE_ALL_CERT_ERRORS)) | 1305 HttpTransactionFactory* factory = context_->http_transaction_factory(); |
| 1306 return OK; | 1306 if (factory) { |
| 1307 HttpNetworkSession* session = factory->GetSession(); |
| 1308 if (session && session->params().ignore_certificate_errors) |
| 1309 return OK; |
| 1310 } |
| 1311 } |
| 1307 | 1312 |
| 1308 if (!delegate_) | 1313 if (!delegate_) |
| 1309 return result; | 1314 return result; |
| 1310 | 1315 |
| 1311 SSLInfo ssl_info; | 1316 SSLInfo ssl_info; |
| 1312 ssl_socket->GetSSLInfo(&ssl_info); | 1317 ssl_socket->GetSSLInfo(&ssl_info); |
| 1313 | 1318 |
| 1314 TransportSecurityState::DomainState domain_state; | 1319 TransportSecurityState::DomainState domain_state; |
| 1315 DCHECK(context_); | 1320 DCHECK(context_); |
| 1316 const bool fatal = | 1321 const bool fatal = |
| 1317 context_->transport_security_state() && | 1322 context_->transport_security_state() && |
| 1318 context_->transport_security_state()->GetDomainState( | 1323 context_->transport_security_state()->GetDomainState( |
| 1319 url_.host(), | 1324 url_.host(), |
| 1320 SSLConfigService::IsSNIAvailable(context_->ssl_config_service()), | 1325 SSLConfigService::IsSNIAvailable(context_->ssl_config_service()), |
| 1321 &domain_state); | 1326 &domain_state); |
| 1322 | 1327 |
| 1323 delegate_->OnSSLCertificateError(this, ssl_info, fatal); | 1328 delegate_->OnSSLCertificateError(this, ssl_info, fatal); |
| 1324 return ERR_IO_PENDING; | 1329 return ERR_IO_PENDING; |
| 1325 } | 1330 } |
| 1326 | 1331 |
| 1327 SSLConfigService* SocketStream::ssl_config_service() const { | 1332 SSLConfigService* SocketStream::ssl_config_service() const { |
| 1328 return context_->ssl_config_service(); | 1333 return context_->ssl_config_service(); |
| 1329 } | 1334 } |
| 1330 | 1335 |
| 1331 ProxyService* SocketStream::proxy_service() const { | 1336 ProxyService* SocketStream::proxy_service() const { |
| 1332 return context_->proxy_service(); | 1337 return context_->proxy_service(); |
| 1333 } | 1338 } |
| 1334 | 1339 |
| 1335 } // namespace net | 1340 } // namespace net |
| OLD | NEW |