ruby-changes:69390
From: Kazuki <ko1@a...>
Date: Mon, 25 Oct 2021 00:43:46 +0900 (JST)
Subject: [ruby-changes:69390] fa24e7a57e (master): [ruby/openssl] ssl: use SSL_get_rbio() to check if SSL is started or not
https://git.ruby-lang.org/ruby.git/commit/?id=fa24e7a57e From fa24e7a57e15900c01fa84d7ff5b0905f6bb6092 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi <k@r...> Date: Fri, 19 Mar 2021 19:18:25 +0900 Subject: [ruby/openssl] ssl: use SSL_get_rbio() to check if SSL is started or not Use SSL_get_rbio() instead of SSL_get_fd(). SSL_get_fd() internally calls SSL_get_rbio() and it's enough for our purpose. In OpenSSL 3.0, SSL_get_fd() leaves an entry in the OpenSSL error queue if BIO has not been set up yet, and we would have to clean it up. https://github.com/ruby/openssl/commit/e95ee24867 --- ext/openssl/ossl_ssl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 5d6c400c2a..a0f18d5388 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1443,8 +1443,8 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1443 static inline int ssl_started(SSL *ssl) { - /* the FD is set in ossl_ssl_setup(), called by #connect or #accept */ - return SSL_get_fd(ssl) >= 0; + /* BIO is created through ossl_ssl_setup(), called by #connect or #accept */ + return SSL_get_rbio(ssl) != NULL; } static void -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/