mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Use BIO for SSL connection.
This commit is contained in:
parent
22f124f871
commit
ba1107541e
1 changed files with 4 additions and 1 deletions
|
@ -1111,7 +1111,10 @@ template <typename U, typename T>
|
||||||
inline bool read_and_close_socket_ssl(socket_t sock, SSL_CTX* ctx, U SSL_connect_or_accept, T callback)
|
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);
|
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);
|
SSL_connect_or_accept(ssl);
|
||||||
|
|
||||||
SSLSocketStream strm(ssl);
|
SSLSocketStream strm(ssl);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue