summaryrefslogtreecommitdiff
path: root/lib/tls.js
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)
downloadandroid-node-v8-4580be088238853ac84d600a56a05159190c1729.tar.gz
android-node-v8-4580be088238853ac84d600a56a05159190c1729.tar.bz2
android-node-v8-4580be088238853ac84d600a56a05159190c1729.zip
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 3ec126e3c4..5385912173 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);