ssl: deprecate OpenSSL::SSL::SSLServer - #1096
Open
rhenium wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Although
OpenSSL::SSL::SSLServerpresents itself as a TCPServer-like wrapper, its design has flaws. DocumentOpenSSL::SSL::SSLServeras deprecated and recommend usingOpenSSL::SSL::SSLSocketdirectly.SSLServer#acceptcalls#accepton 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
SSLServerwhile their TLS handshakes complete, which would be too significant a change.This is also why
SSLServer#accept_nonblockwas never implemented.The blocking behavior of
#acceptcan be worked around by settingSSLServer#start_immediatelytofalse, which skips the handshake. However, at that pointSSLServerprovides little value over usingTCPServerdirectly and wrapping each accepted socket withSSLSocket.#1094 reminded me of this.