From ba1107541e0ccd71250eba3d5c42a3c6711a89a9 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 13 May 2017 23:43:09 -0400 Subject: [PATCH] Use BIO for SSL connection. --- httplib.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/httplib.h b/httplib.h index 4ec9a0f..8f52c11 100644 --- a/httplib.h +++ b/httplib.h @@ -1111,7 +1111,10 @@ template inline bool read_and_close_socket_ssl(socket_t sock, SSL_CTX* ctx, U SSL_connect_or_accept, T callback) { auto ssl = SSL_new(ctx); - SSL_set_fd(ssl, sock); + + auto bio = BIO_new_socket(sock, BIO_NOCLOSE); + SSL_set_bio(ssl, bio, bio); + SSL_connect_or_accept(ssl); SSLSocketStream strm(ssl);