forked from ruby/openssl
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssl: support IO-like object as an underlying transport
Currently, OpenSSL::SSL::SSLSocket requires an IO (socket) object because it passes the file descriptor to OpenSSL, bypassing Ruby's IO stack. There are use cases where somebody wants to establish a TLS connection on top of a non-OS stream, for example, another TLS connection or an HTTP/2 tunnel. Doing such a thing currently requires a workaround, such as using a socket pair. OpenSSL internally uses an IO abstraction layer called BIO to interact with the underlying socket in the TLS implementation. We implicitly use the BIO_s_socket() BIO_METHOD via an SSL_set_fd() call, but we can provide an alternative BIO_METHOD that wraps Ruby IO methods. For performance reason, this patch continues to use the socket BIO if the user passes a real IO object.
- Loading branch information
Showing
3 changed files
with
225 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.