Skip to content

ssl: deprecate OpenSSL::SSL::SSLServer - #1096

Open
rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/ssl-deprecate-sslserver
Open

ssl: deprecate OpenSSL::SSL::SSLServer#1096
rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/ssl-deprecate-sslserver

Conversation

@rhenium

@rhenium rhenium commented Aug 25, 2026

Copy link
Copy Markdown
Member

Although OpenSSL::SSL::SSLServer presents itself as a TCPServer-like wrapper, its design has flaws. Document OpenSSL::SSL::SSLServer as deprecated and recommend using OpenSSL::SSL::SSLSocket directly.

SSLServer#accept calls #accept on the underlying listening socket and then performs the TLS handshake synchronously. This is an obvious problem for programs that expect more than one client to connect.

Fixing this would require keeping a backlog of accepted TCP connections in SSLServer while their TLS handshakes complete, which would be too significant a change.

This is also why SSLServer#accept_nonblock was never implemented.

The blocking behavior of #accept can be worked around by setting SSLServer#start_immediately to false, which skips the handshake. However, at that point SSLServer provides little value over using TCPServer directly and wrapping each accepted socket with SSLSocket.

#1094 reminded me of this.

Although OpenSSL::SSL::SSLServer presents itself as a TCPServer-like
wrapper, its design has flaws. Document OpenSSL::SSL::SSLServer as
deprecated and recommend using OpenSSL::SSL::SSLSocket directly.

SSLServer#accept calls #accept on the underlying listening socket and
then performs the TLS handshake synchronously. This is an obvious
problem for programs that expect more than one client to connect.

Fixing this would require keeping a backlog of accepted TCP connections
in SSLServer while their TLS handshakes complete, which would be too
significant a change.

This is also why SSLServer#accept_nonblock was never implemented.

The blocking behavior of #accept can be worked around by setting
SSLServer#start_immediately to false, which skips the handshake.
However, at that point SSLServer provides little value over using
TCPServer directly and wrapping each accepted socket with SSLSocket.
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