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

Commit a2a3fd4

Browse files
committed
tls_wrap: ignore ZERO_RETURN after close_notify
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
1 parent 6462519 commit a2a3fd4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tls_wrap.cc

+8
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ void TLSCallbacks::ClearOut() {
447447
if (!hello_parser_.IsEnded())
448448
return;
449449

450+
// No reads after EOF
451+
if (eof_)
452+
return;
453+
450454
HandleScope handle_scope(env()->isolate());
451455
Context::Scope context_scope(env()->context());
452456

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

483+
// Ignore ZERO_RETURN after EOF, it is basically not a error
484+
if (err == SSL_ERROR_ZERO_RETURN && eof_)
485+
return;
486+
479487
if (!arg.IsEmpty()) {
480488
// When TLS Alert are stored in wbio,
481489
// it should be flushed to socket before destroyed.

0 commit comments

Comments
 (0)