OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 if (ssl_config_.IsAllowedBadCert(ssl_info.cert, NULL)) { | 880 if (ssl_config_.IsAllowedBadCert(ssl_info.cert, NULL)) { |
881 // If we already have the certificate in the set of allowed bad | 881 // If we already have the certificate in the set of allowed bad |
882 // certificates, we did try it and failed again, so we should not | 882 // certificates, we did try it and failed again, so we should not |
883 // retry again: the connection should fail at last. | 883 // retry again: the connection should fail at last. |
884 next_state_ = STATE_CLOSE; | 884 next_state_ = STATE_CLOSE; |
885 return result; | 885 return result; |
886 } | 886 } |
887 // Add the bad certificate to the set of allowed certificates in the | 887 // Add the bad certificate to the set of allowed certificates in the |
888 // SSL config object. | 888 // SSL config object. |
889 SSLConfig::CertAndStatus bad_cert; | 889 SSLConfig::CertAndStatus bad_cert; |
890 bad_cert.cert = ssl_info.cert; | 890 if (!ssl_info.cert->GetDEREncoded(&bad_cert.cert_der)) { |
| 891 next_state_ = STATE_CLOSE; |
| 892 return result; |
| 893 } |
891 bad_cert.cert_status = ssl_info.cert_status; | 894 bad_cert.cert_status = ssl_info.cert_status; |
892 ssl_config_.allowed_bad_certs.push_back(bad_cert); | 895 ssl_config_.allowed_bad_certs.push_back(bad_cert); |
893 // Restart connection ignoring the bad certificate. | 896 // Restart connection ignoring the bad certificate. |
894 socket_->Disconnect(); | 897 socket_->Disconnect(); |
895 socket_.reset(); | 898 socket_.reset(); |
896 next_state_ = STATE_TCP_CONNECT; | 899 next_state_ = STATE_TCP_CONNECT; |
897 return OK; | 900 return OK; |
898 } | 901 } |
899 } | 902 } |
900 | 903 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 | 1081 |
1079 SSLConfigService* SocketStream::ssl_config_service() const { | 1082 SSLConfigService* SocketStream::ssl_config_service() const { |
1080 return context_->ssl_config_service(); | 1083 return context_->ssl_config_service(); |
1081 } | 1084 } |
1082 | 1085 |
1083 ProxyService* SocketStream::proxy_service() const { | 1086 ProxyService* SocketStream::proxy_service() const { |
1084 return context_->proxy_service(); | 1087 return context_->proxy_service(); |
1085 } | 1088 } |
1086 | 1089 |
1087 } // namespace net | 1090 } // namespace net |
OLD | NEW |