Skip to content

Conversation

@alanjds
Copy link

@alanjds alanjds commented Dec 7, 2025

This adds SSL support for server and client modes, using rustls as backend.

I got it to work flawlessly with TLS v1.2 only. When TLS v1.3 is selected, it almost always works correctly but sometimes it hangs when running as Server and the non-rustls client closes the connection.

To investigate this behaviour I wrote cross-implementation tests with standard Asyncio and seems that the disconnection is often not detected, but only when Asyncio is the client. When RLoop is the server (on another process) and RLoop is the client, it always works with TLS 1.3.

Also wrote tests with requests, openssl and raw sockets as clients. They all sometimes fails for TLS 1.3 and never fails for TLS 1.2, but openssl seems specially picky and fails a lot more than the others.

Because that, the RLOOP_TLS_VERSION envvar is 1.2 by default. The possible values are 1.2, 1.2+ and 1.3. The TLS 1.2+ and 1.3 flaky tests are marked as XFAIL on pytest.

Added SSL basic tests
Base infra for SSL tests with timeout
Fix SSL client tests and have a working SSL server tests
with asyncio. RLoop SSL server still broken
Handle SSL handshake & shutdowns differently between client and server:

Client initiates handshake immediately
Server waits the client to connect.
Somehow working TLS server
SSl suites listing
Fixed the requests test, and the SSL context for server
SSL closing handshake almost good, with new debug and waiting more before closing
Tests refactor & trying a larger TLS close window
TLS 1.3 _sometimes_ hangs on closing
- Better comments
- Simplify the TCP TLS creating call
- Update crates
- Compressing comments
@alanjds alanjds mentioned this pull request Dec 7, 2025
Also SKIP the TLS 1.2+ tests with Asyncio standard,
as the 1st test _is_ 1.2+ for this reactor
@alanjds alanjds marked this pull request as ready for review December 8, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant