Skip to content

Commit 4f17fba

Browse files
committed
Missing change for wolfSSL support
1 parent 0d5bf55 commit 4f17fba

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

httplib.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18370,6 +18370,7 @@ inline ctx_t create_server_context() {
1837018370
// Enable SNI on server
1837118371
wolfSSL_CTX_SNI_SetOptions(ctx->ctx, WOLFSSL_SNI_HOST_NAME,
1837218372
WOLFSSL_SNI_CONTINUE_ON_MISMATCH);
18373+
wolfSSL_CTX_set_servername_callback(ctx->ctx, impl::wolfssl_sni_callback);
1837318374

1837418375
return static_cast<ctx_t>(ctx);
1837518376
}
@@ -18569,11 +18570,6 @@ inline session_t create_session(ctx_t ctx, socket_t sock) {
1856918570

1857018571
wolfSSL_set_fd(session->ssl, static_cast<int>(sock));
1857118572

18572-
// Set up SNI callback for server
18573-
if (wctx->is_server) {
18574-
wolfSSL_CTX_set_servername_callback(wctx->ctx, impl::wolfssl_sni_callback);
18575-
}
18576-
1857718573
return static_cast<session_t>(session);
1857818574
}
1857918575

@@ -18837,9 +18833,9 @@ inline bool is_peer_closed(session_t session, socket_t sock) {
1883718833
auto cleanup =
1883818834
detail::scope_exit([&]() { detail::set_nonblocking(sock, false); });
1883918835

18840-
// Try a 1-byte read to check connection status
18836+
// Peek 1 byte to check connection status without consuming data
1884118837
unsigned char buf;
18842-
int ret = wolfSSL_read(wsession->ssl, &buf, 1);
18838+
int ret = wolfSSL_peek(wsession->ssl, &buf, 1);
1884318839

1884418840
// If we got data or WANT_READ (would block), connection is alive
1884518841
if (ret > 0) { return false; }

0 commit comments

Comments
 (0)