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

Commit 1ebb841

Browse files
committed
Use SSL_ERROR_ZERO_RETURN to check if the SSL peer is closed.
1 parent 7b69999 commit 1ebb841

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

httplib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6765,7 +6765,8 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
67656765
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
67666766
if (is_ssl()) {
67676767
char buf[1];
6768-
if (SSL_peek(socket_.ssl, buf, 1) == 0) {
6768+
if (SSL_peek(socket_.ssl, buf, 1) == 0 &&
6769+
SSL_get_error(socket_.ssl, 0) == SSL_ERROR_ZERO_RETURN) {
67696770
error = Error::SSLPeerCouldBeClosed_;
67706771
return false;
67716772
}

0 commit comments

Comments
 (0)