| 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 #if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED) | 5 #if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED) |
| 6 | 6 |
| 7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 8 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_LINUX) || \ | 8 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_LINUX) || \ |
| 9 defined(TARGET_OS_WINDOWS) || defined(TARGET_OS_FUCHSIA) | 9 defined(TARGET_OS_WINDOWS) || defined(TARGET_OS_FUCHSIA) |
| 10 | 10 |
| (...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 } | 1562 } |
| 1563 Handshake(); | 1563 Handshake(); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 | 1566 |
| 1567 int printErrorCallback(const char* str, size_t len, void* ctx) { | 1567 int printErrorCallback(const char* str, size_t len, void* ctx) { |
| 1568 Log::PrintErr("%.*s\n", static_cast<int>(len), str); | 1568 Log::PrintErr("%.*s\n", static_cast<int>(len), str); |
| 1569 return 1; | 1569 return 1; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 |
| 1572 void SSLFilter::Handshake() { | 1573 void SSLFilter::Handshake() { |
| 1573 // Try and push handshake along. | 1574 // Try and push handshake along. |
| 1574 int status; | 1575 int status; |
| 1575 status = SSL_do_handshake(ssl_); | 1576 status = SSL_do_handshake(ssl_); |
| 1576 if (callback_error != NULL) { | 1577 if (callback_error != NULL) { |
| 1577 // The SSL_do_handshake will try performing a handshake and might call | 1578 // The SSL_do_handshake will try performing a handshake and might call |
| 1578 // a CertificateCallback. If the certificate validation | 1579 // a CertificateCallback. If the certificate validation |
| 1579 // failed the 'callback_error" will be set by the certificateCallback | 1580 // failed the 'callback_error" will be set by the certificateCallback |
| 1580 // logic and we propagate the error" | 1581 // logic and we propagate the error" |
| 1581 Dart_PropagateError(callback_error); | 1582 Dart_PropagateError(callback_error); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1603 X509_NAME_print_ex_fp(stdout, s_name, 4, 0); | 1604 X509_NAME_print_ex_fp(stdout, s_name, 4, 0); |
| 1604 printf("\n"); | 1605 printf("\n"); |
| 1605 } | 1606 } |
| 1606 } | 1607 } |
| 1607 ThrowIfError(Dart_InvokeClosure( | 1608 ThrowIfError(Dart_InvokeClosure( |
| 1608 Dart_HandleFromPersistent(handshake_complete_), 0, NULL)); | 1609 Dart_HandleFromPersistent(handshake_complete_), 0, NULL)); |
| 1609 in_handshake_ = false; | 1610 in_handshake_ = false; |
| 1610 } | 1611 } |
| 1611 } | 1612 } |
| 1612 | 1613 |
| 1614 |
| 1613 void SSLFilter::GetSelectedProtocol(Dart_NativeArguments args) { | 1615 void SSLFilter::GetSelectedProtocol(Dart_NativeArguments args) { |
| 1614 const uint8_t* protocol; | 1616 const uint8_t* protocol; |
| 1615 unsigned length; | 1617 unsigned length; |
| 1616 SSL_get0_alpn_selected(ssl_, &protocol, &length); | 1618 SSL_get0_alpn_selected(ssl_, &protocol, &length); |
| 1617 if (length == 0) { | 1619 if (length == 0) { |
| 1618 Dart_SetReturnValue(args, Dart_Null()); | 1620 Dart_SetReturnValue(args, Dart_Null()); |
| 1619 } else { | 1621 } else { |
| 1620 Dart_SetReturnValue(args, Dart_NewStringFromUTF8(protocol, length)); | 1622 Dart_SetReturnValue(args, Dart_NewStringFromUTF8(protocol, length)); |
| 1621 } | 1623 } |
| 1622 } | 1624 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 return bytes_processed; | 1761 return bytes_processed; |
| 1760 } | 1762 } |
| 1761 | 1763 |
| 1762 } // namespace bin | 1764 } // namespace bin |
| 1763 } // namespace dart | 1765 } // namespace dart |
| 1764 | 1766 |
| 1765 #endif // defined(TARGET_OS_LINUX) | 1767 #endif // defined(TARGET_OS_LINUX) |
| 1766 | 1768 |
| 1767 #endif // !defined(DART_IO_DISABLED) && | 1769 #endif // !defined(DART_IO_DISABLED) && |
| 1768 // !defined(DART_IO_SECURE_SOCKET_DISABLED) | 1770 // !defined(DART_IO_SECURE_SOCKET_DISABLED) |
| OLD | NEW |