From 1a6efb61202d75ac0f5d3f8bb766388c366aff2f Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 5 Jun 2019 09:44:46 +0200 Subject: [PATCH] crypto: add debug info client emit secureConnect Currently, when debugging a TLS connection there might be multiple debug statements 'client emit secureConnect' for the 'secureConnect` event when using NODE_DEBUG='tls'. While it is possible to step through this with a debugger that is not always the fastest/easiest to do if debugging remote code. This commit adds some additional information to the debug statements to make it easier to distinguish where the debug statements are coming from. --- lib/_tls_wrap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 58ad741cbf2172..d3483fc44a34b2 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1335,12 +1335,14 @@ function onConnectSecure() { this.destroy(verifyError); return; } else { - debug('client emit secureConnect'); + debug('client emit secureConnect. rejectUnauthorized: %s, ' + + 'authorizationError: %s', options.rejectUnauthorized, + this.authorizationError); this.emit('secureConnect'); } } else { this.authorized = true; - debug('client emit secureConnect'); + debug('client emit secureConnect. authorized:', this.authorized); this.emit('secureConnect'); }