| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/secure_socket.h" | 5 #include "bin/secure_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 status = SSL_OptionSet(filter_, | 731 status = SSL_OptionSet(filter_, |
| 732 SSL_REQUIRE_CERTIFICATE, | 732 SSL_REQUIRE_CERTIFICATE, |
| 733 require_client_certificate); | 733 require_client_certificate); |
| 734 if (status != SECSuccess) { | 734 if (status != SECSuccess) { |
| 735 ThrowPRException("TlsException", | 735 ThrowPRException("TlsException", |
| 736 "Failed SSL_OptionSet(REQUIRE_CERTIFICATE) call"); | 736 "Failed SSL_OptionSet(REQUIRE_CERTIFICATE) call"); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 } else { // Client. | 739 } else { // Client. |
| 740 if (SSL_SetURL(filter_, host_name) == -1) { | 740 if (SSL_SetURL(filter_, host_name) == -1) { |
| 741 ThrowPRException("TlsException", | 741 ThrowPRException("TlsException", "Failed SetURL call"); |
| 742 "Failed SetURL call"); | |
| 743 } | 742 } |
| 744 | |
| 745 // This disables the SSL session cache for client connections. | |
| 746 // This resolves issue 7208, but degrades performance. | |
| 747 // TODO(7230): Reenable session cache, without breaking client connections. | |
| 748 status = SSL_OptionSet(filter_, SSL_NO_CACHE, PR_TRUE); | |
| 749 if (status != SECSuccess) { | |
| 750 ThrowPRException("TlsException", | |
| 751 "Failed SSL_OptionSet(NO_CACHE) call"); | |
| 752 } | |
| 753 | |
| 754 if (send_client_certificate) { | 743 if (send_client_certificate) { |
| 755 SSL_SetPKCS11PinArg(filter_, const_cast<char*>(password_)); | 744 SSL_SetPKCS11PinArg(filter_, const_cast<char*>(password_)); |
| 756 status = SSL_GetClientAuthDataHook( | 745 status = SSL_GetClientAuthDataHook( |
| 757 filter_, | 746 filter_, |
| 758 NSS_GetClientAuthData, | 747 NSS_GetClientAuthData, |
| 759 static_cast<void*>(client_certificate_name_)); | 748 static_cast<void*>(client_certificate_name_)); |
| 760 if (status != SECSuccess) { | 749 if (status != SECSuccess) { |
| 761 ThrowPRException("TlsException", | 750 ThrowPRException("TlsException", |
| 762 "Failed SSL_GetClientAuthDataHook call"); | 751 "Failed SSL_GetClientAuthDataHook call"); |
| 763 } | 752 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 if (service_port != ILLEGAL_PORT) { | 965 if (service_port != ILLEGAL_PORT) { |
| 977 // Return a send port for the service port. | 966 // Return a send port for the service port. |
| 978 Dart_Handle send_port = Dart_NewSendPort(service_port); | 967 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 979 Dart_SetReturnValue(args, send_port); | 968 Dart_SetReturnValue(args, send_port); |
| 980 } | 969 } |
| 981 } | 970 } |
| 982 | 971 |
| 983 | 972 |
| 984 } // namespace bin | 973 } // namespace bin |
| 985 } // namespace dart | 974 } // namespace dart |
| OLD | NEW |