Repository navigation
ssl: implement blocking SSLSocket methods in Ruby - #1105
Merged
Merged
Conversation
This was referenced Sep 2, 2026
rhenium
force-pushed
the
ky/ssl-blocking-in-ruby
branch
from
October 10, 2026 09:36
34fdd01 to
d6e94e0
Compare
Let the extension provide only the essential part to call the OpenSSL API: SSLSocket#ssl_connect, #ssl_accept, #ssl_read, and #ssl_write. Implement the public methods in ssl.rb: SSLSocket#connect, #accept, #sysread, and #syswrite, along with their #*_nonblock variants. This greatly simplifies code and prepares for the upcoming patches to add proper timeout support and closed-stream state tracking, which do not need to be in the extension.
Currently String.new(capacity: len) causes Hash allocations for the keyword arguments, which is undesirable in this hot path. This workaround should be reverted once it is no longer necessary.
rhenium
force-pushed
the
ky/ssl-blocking-in-ruby
branch
from
October 11, 2026 05:46
d6e94e0 to
802ef88
Compare
Closed
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.
Let the extension only provide the most basic non-blocking form,
SSLSocket#ssl_connect,#ssl_accept,#ssl_read,#ssl_write.Implement
SSLSocket#connect,#accept,#sysread, and#syswriteinlib/openssl/ssl.rbon top of these primitives and#wait_{read,writ}able.Also, handle the keyword arguments for the public
#*_nonblockmethods in Ruby to simplify and to avoid theHashallocation.This prepares for the upcoming changes to
SSLSocketto add proper timeout support and socket closed state tracking. These would be easier to do in Ruby.No user-visible behavior change is intended with this patch.