Skip to content

Add an optional TLS channel to Client and Server - #28

Merged
viacheslauK merged 19 commits into
mainfrom
tls
Nov 24, 2026
Merged

viacheslauK merged 19 commits into
mainfrom
tls

Conversation

@viacheslauK

@viacheslauK viacheslauK commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a TLS-encrypted transport next to the plaintext one, with server-only and mutual TLS. It is behind the new CMake option NATIVE_STREAMING_ENABLE_TLS (default OFF), the only part of the library that needs OpenSSL.

Changes

  • Groundwork. Session, AsyncReader and AsyncWriter now go through a transport-neutral IWsStream interface instead of WebsocketStream. Server keeps its accept state per connection (AcceptOp) instead of in shared members.
  • Build. With the option on, OpenSSL ≥ 1.1.1 is found, linked publicly and passed on through Config.cmake.in. With it off, tls.hpp is not installed.
  • API. tls.hpp adds the SSL context builders. Client gets a constructor that takes a ClientTlsConfig and an optional onTlsHandshakeFailCallback. Server::startTls() opens a TLS port alongside or instead of the plaintext one.
  • Tests. The connection suite runs over both transports. test_tls.cpp covers trust, mTLS, port mismatches and secret validation. Test certificates are committed under test/secrets/ (regenerated by gen_certs.sh).
  • CI. The Ubuntu and Windows jobs install OpenSSL and build and test with NATIVE_STREAMING_ENABLE_TLS=ON.

@CLAassistant

CLAassistant commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@viacheslauK viacheslauK changed the title Tls Add an optional TLS channel to Client and Server Sep 11, 2026
@viacheslauK
viacheslauK marked this pull request as ready for review September 11, 2026 12:11
@viacheslauK viacheslauK self-assigned this Sep 11, 2026
The accept path of v1.0.22 is applied to both listeners, plain and TLS:
- the acceptor is re-armed right after a connection is accepted, so the
  later re-arms after the TLS handshake and after the request read are gone;
- AcceptOp holds the capped flat_buffer and the request_parser with
  body_limit(0) in place of the streambuf and the request;
- the 5 s timeout is set before the TLS handshake, so it covers the
  handshake and the request read.
@JakaMohorko JakaMohorko added the enhancement New feature or request label Nov 20, 2026
Comment thread CMakeLists.txt Resolved
@viacheslauK
viacheslauK merged commit 07c8ee4 into main Nov 24, 2026
6 checks passed
@viacheslauK
viacheslauK deleted the tls branch November 24, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants