Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-03-28 20:55:51 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-03-28 21:59:19 +0400
commit4580be088238853ac84d600a56a05159190c1729 (patch)
treeb4437f67dc3da20a11337e9e38157d74c1f922a5 /lib/tls.js
parent39058bef0733e6fae3cf160d71935127eab97bdd (diff)
tls: handle SSL_ERROR_ZERO_RETURN
see #5004
Diffstat (limited to 'lib/tls.js')
-rw-r--r--lib/tls.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 3ec126e3c41..53859121733 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -922,9 +922,13 @@ SecurePair.prototype.error = function(returnOnly) {
this.ssl.error = null;
if (!this._secureEstablished) {
- if (!err) {
- err = new Error('socket hang up');
- err.code = 'ECONNRESET';
+ // Emit ECONNRESET instead of zero return
+ if (!err || err.message === 'ZERO_RETURN') {
+ var connReset = new Error('socket hang up');
+ connReset.code = 'ECONNRESET';
+ connReset.sslError = err && err.message;
+
+ err = connReset;
}
this.destroy();
if (!returnOnly) this.emit('error', err);