mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-21 11:39:48 +00:00
Missing change for wolfSSL support
This commit is contained in:
1 parent
0d5bf55c73
commit
4f17fbaa03
1 file changed
+3
-7
@@ -18370,6 +18370,7 @@ inline ctx_t create_server_context() {
|
|||||||
// Enable SNI on server
|
// Enable SNI on server
|
||||||
wolfSSL_CTX_SNI_SetOptions(ctx->ctx, WOLFSSL_SNI_HOST_NAME,
|
wolfSSL_CTX_SNI_SetOptions(ctx->ctx, WOLFSSL_SNI_HOST_NAME,
|
||||||
WOLFSSL_SNI_CONTINUE_ON_MISMATCH);
|
WOLFSSL_SNI_CONTINUE_ON_MISMATCH);
|
||||||
|
wolfSSL_CTX_set_servername_callback(ctx->ctx, impl::wolfssl_sni_callback);
|
||||||
|
|
||||||
return static_cast<ctx_t>(ctx);
|
return static_cast<ctx_t>(ctx);
|
||||||
}
|
}
|
||||||
@@ -18569,11 +18570,6 @@ inline session_t create_session(ctx_t ctx, socket_t sock) {
|
|||||||
|
|
||||||
wolfSSL_set_fd(session->ssl, static_cast<int>(sock));
|
wolfSSL_set_fd(session->ssl, static_cast<int>(sock));
|
||||||
|
|
||||||
// Set up SNI callback for server
|
|
||||||
if (wctx->is_server) {
|
|
||||||
wolfSSL_CTX_set_servername_callback(wctx->ctx, impl::wolfssl_sni_callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<session_t>(session);
|
return static_cast<session_t>(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18837,9 +18833,9 @@ inline bool is_peer_closed(session_t session, socket_t sock) {
|
|||||||
auto cleanup =
|
auto cleanup =
|
||||||
detail::scope_exit([&]() { detail::set_nonblocking(sock, false); });
|
detail::scope_exit([&]() { detail::set_nonblocking(sock, false); });
|
||||||
|
|
||||||
// Try a 1-byte read to check connection status
|
// Peek 1 byte to check connection status without consuming data
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret = wolfSSL_read(wsession->ssl, &buf, 1);
|
int ret = wolfSSL_peek(wsession->ssl, &buf, 1);
|
||||||
|
|
||||||
// If we got data or WANT_READ (would block), connection is alive
|
// If we got data or WANT_READ (would block), connection is alive
|
||||||
if (ret > 0) { return false; }
|
if (ret > 0) { return false; }
|
||||||
|
|||||||
Reference in new issue
Block a user