Compare commits

..

No commits in common. "2f089535a3193334f8a01ea84ed848df2e20f9d9" and "d5493a185a5dcc48beaf229c1055c570f3cde2ef" have entirely different histories.

3 changed files with 10 additions and 11 deletions

View File

@ -1 +1 @@
include: ../../analysis_options.yaml include: ../analysis_options.yaml

View File

@ -1,4 +1,4 @@
include: ../../analysis_options.yaml include: ../analysis_options.yaml
analyzer: analyzer:
exclude: exclude:

View File

@ -50,12 +50,11 @@ class TCPSocketWrapper extends BaseSocketWrapper {
return <MoxSrvRecord>[]; return <MoxSrvRecord>[];
} }
/// Called when we encounter a certificate we cannot verify. [certificate] refers to the certificate bool _onBadCertificate(dynamic certificate, String domain) {
/// in question, while [domain] refers to the domain we try to validate the certificate against. _log.fine('Bad certificate: ${certificate.toString()}');
/// //final isExpired = certificate.endValidity.isAfter(DateTime.now());
/// Return true if the certificate should be accepted. Return false if it should be rejected. // TODO(Unknown): Either validate the certificate ourselves or use a platform native
@visibleForOverriding // hostname verifier (or Dart adds it themselves)
bool onBadCertificate(dynamic certificate, String domain) {
return false; return false;
} }
@ -84,7 +83,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
sock, sock,
host: domain, host: domain,
supportedProtocols: const [ xmppClientALPNId ], supportedProtocols: const [ xmppClientALPNId ],
onBadCertificate: (cert) => onBadCertificate(cert, domain), onBadCertificate: (cert) => _onBadCertificate(cert, domain),
); );
_ignoreSocketClosure = false; _ignoreSocketClosure = false;
@ -176,7 +175,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
_socket = await SecureSocket.secure( _socket = await SecureSocket.secure(
_socket!, _socket!,
supportedProtocols: const [ xmppClientALPNId ], supportedProtocols: const [ xmppClientALPNId ],
onBadCertificate: (cert) => onBadCertificate(cert, domain), onBadCertificate: (cert) => _onBadCertificate(cert, domain),
); );
_secure = true; _secure = true;