From f4b02dfdc199a3a704ca66f2debf1347f81e5547 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 25 Mar 2023 21:13:07 -0400 Subject: [PATCH] Fix #1533 --- httplib.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/httplib.h b/httplib.h index c12a5a2..2fdf609 100644 --- a/httplib.h +++ b/httplib.h @@ -6826,11 +6826,14 @@ 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 && - SSL_get_error(socket_.ssl, 0) == SSL_ERROR_ZERO_RETURN) { - error = Error::SSLPeerCouldBeClosed_; - return false; + auto is_proxy_enabled = !proxy_host_.empty() && proxy_port_ != -1; + if (!is_proxy_enabled) { + char buf[1]; + if (SSL_peek(socket_.ssl, buf, 1) == 0 && + SSL_get_error(socket_.ssl, 0) == SSL_ERROR_ZERO_RETURN) { + error = Error::SSLPeerCouldBeClosed_; + return false; + } } } #endif