Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
tls_wrap: ignore ZERO_RETURN after close_notify
Browse files Browse the repository at this point in the history
Do not call SSL_read() and ignore ZERO_RETURN if the connection was
shutdown and there could not be any reads.

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #8519
  • Loading branch information
indutny committed Oct 8, 2014
1 parent 6462519 commit a2a3fd4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ void TLSCallbacks::ClearOut() {
if (!hello_parser_.IsEnded())
return;

// No reads after EOF
if (eof_)
return;

HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand Down Expand Up @@ -476,6 +480,10 @@ void TLSCallbacks::ClearOut() {
int err;
Local<Value> arg = GetSSLError(read, &err, NULL);

// Ignore ZERO_RETURN after EOF, it is basically not a error
if (err == SSL_ERROR_ZERO_RETURN && eof_)
return;

if (!arg.IsEmpty()) {
// When TLS Alert are stored in wbio,
// it should be flushed to socket before destroyed.
Expand Down

0 comments on commit a2a3fd4

Please sign in to comment.