Browse Source

tls: handle SSL_ERROR_ZERO_RETURN

see #5004
v0.10.2-release
Fedor Indutny 12 years ago
parent
commit
4580be0882
  1. 10
      lib/tls.js
  2. 5
      src/node_crypto.cc

10
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);

5
src/node_crypto.cc

@ -927,6 +927,11 @@ int Connection::HandleSSLError(const char* func, int rv, ZeroStatus zs) {
DEBUG_PRINT("[%p] SSL: %s want read\n", ssl_, func);
return 0;
} else if (err == SSL_ERROR_ZERO_RETURN) {
handle_->Set(String::New("error"),
Exception::Error(String::New("ZERO_RETURN")));
return rv;
} else {
HandleScope scope;
BUF_MEM* mem;

Loading…
Cancel
Save