Add SSLSocket server handshake aliases - #1094
Conversation
Add SSLSocket#start and #start_nonblock as aliases for #accept and #accept_nonblock. This gives server code a handshake-oriented name when SSLServer#start_immediately is disabled, while preserving the existing interface and behavior.\n\nRelated to ruby#760. Assisted-By: devx/3ed43c18-3c9a-4ad9-a6f5-6668caa29658
|
TLS is a client-initiated protocol, so if we had As I've written in #760, I don't really see problems with the current names
|
|
Thanks. The concrete problem is that
if socket.respond_to?(:start)
socket.start
endThe actual implementation is here: https://github.com/socketry/io-endpoint/blob/5e7c6aff6ba7b52c1a30f6d3a6e5a5aa86b41bf0/lib/io/endpoint/wrapper.rb#L217-L226 For an Therefore, This PR does not replace or change |
TL;DR
Add
OpenSSL::SSL::SSLSocket#startand#start_nonblockas aliases for#acceptand#accept_nonblock.Context
When
OpenSSL::SSL::SSLServer#start_immediatelyis disabled,SSLServer#acceptreturns the accepted transport before performing the TLS handshake. The caller then invokesSSLSocket#accepton that already-accepted socket to perform the server-side handshake.io-endpointcurrently defines these aliases itself so accepted connections can be dispatched to a fiber or thread and the TLS handshake can be initiated with#start, without treating handshake initiation as another connection acceptance operation in generic server code.Related to #760.
Changes
SSLSocket#starttoSSLSocket#accept.SSLSocket#start_nonblocktoSSLSocket#accept_nonblock.The existing methods and behavior are unchanged.
Tophatting
bundle exec rake compilebundle exec ruby -Itest -Ilib test/openssl/test_ssl.rb --name=test_server_handshake_aliasesbundle exec rake test(628 tests, 4,606 assertions, 0 failures, 0 errors, 2 expected FIPS omissions)