diff --git a/httplib.h b/httplib.h index 2317276..699c1fb 100644 --- a/httplib.h +++ b/httplib.h @@ -6765,7 +6765,8 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req, #ifdef CPPHTTPLIB_OPENSSL_SUPPORT if (is_ssl()) { char buf[1]; - if (SSL_peek(socket_.ssl, buf, 1) == 0) { + if (SSL_peek(socket_.ssl, buf, 1) == 0 && + SSL_get_error(socket_.ssl, 0) == SSL_ERROR_ZERO_RETURN) { error = Error::SSLPeerCouldBeClosed_; return false; }