File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,10 @@ void TLSWrap::EncOutCb(WriteWrap* req_wrap, int status) {
352
352
Local<Value> TLSWrap::GetSSLError (int status, int * err, const char ** msg) {
353
353
EscapableHandleScope scope (env ()->isolate ());
354
354
355
+ // ssl_ is already destroyed in reading EOF by close notify alert.
356
+ if (ssl_ == nullptr )
357
+ return Local<Value>();
358
+
355
359
*err = SSL_get_error (ssl_, status);
356
360
switch (*err) {
357
361
case SSL_ERROR_NONE:
@@ -432,7 +436,10 @@ void TLSWrap::ClearOut() {
432
436
OnRead (UV_EOF, nullptr );
433
437
}
434
438
435
- if (read == -1 ) {
439
+ // We need to check whether an error occurred or the connection was
440
+ // shutdown cleanly (SSL_ERROR_ZERO_RETURN) even when read == 0.
441
+ // See iojs#1642 and SSL_read(3SSL) for details.
442
+ if (read <= 0 ) {
436
443
int err;
437
444
Local<Value> arg = GetSSLError (read, &err, nullptr );
438
445
You can’t perform that action at this time.
0 commit comments