diff options
author | Mariusz 'koder' Chwalba <mariusz.chwalba@cashbill.pl> | 2016-09-27 08:20:10 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2016-10-10 09:59:31 +0200 |
commit | c7bc9bcfbf511b80f240ece0db49f5d78db8d0fe (patch) | |
tree | cce01dbaf395dbb58920008a6771fb6a0ed6f895 /lib/_tls_wrap.js | |
parent | 7542bddddaccd2453c72a67119e7badc4f2a3933 (diff) | |
download | android-node-v8-c7bc9bcfbf511b80f240ece0db49f5d78db8d0fe.tar.gz android-node-v8-c7bc9bcfbf511b80f240ece0db49f5d78db8d0fe.tar.bz2 android-node-v8-c7bc9bcfbf511b80f240ece0db49f5d78db8d0fe.zip |
tls: TLSSocket emits 'error' on handshake failure
Removes branch that would make TLSSocket emit '_tlsError' event if error
occured on handshake and control was not released, as it was never happening.
Addedd test for tls.Server to ensure it still emits 'tlsClientError' as expected.
Fixes: https://github.com/nodejs/node/issues/8803
PR-URL: https://github.com/nodejs/node/pull/8805
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 6d07272c7c..f3526c7033 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -426,7 +426,9 @@ TLSSocket.prototype._init = function(socket, wrap) { // Destroy socket if error happened before handshake's finish if (!self._secureEstablished) { - self.destroy(self._tlsError(err)); + // When handshake fails control is not yet released, + // so self._tlsError will return null instead of actual error + self.destroy(err); } else if (options.isServer && rejectUnauthorized && /peer did not return a certificate/.test(err.message)) { |