End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
OpenSSL::SSL::Session.new
Session.new(ssl_socket) → Session
Session.new(string) → Session
ext/openssl/ossl_ssl_session.c
View on GitHub ↗
static VALUE
ossl_ssl_session_initialize(VALUE self, VALUE arg1)
{
SSL_SESSION *ctx;
if (RTYPEDDATA_DATA(self))
ossl_raise(eSSLSession, "SSL Session already initialized");
if (rb_obj_is_instance_of(arg1, cSSLSocket)) {
SSL *ssl;
GetSSL(arg1, ssl);
if ((ctx = SSL_get1_session(ssl)) == NULL)
ossl_raise(eSSLSession, "no session available");
}
else {
BIO *in = ossl_obj2bio(&arg1);
ctx = d2i_SSL_SESSION_bio(in, NULL);
if (!ctx) {
OSSL_BIO_reset(in);
ctx = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL);
}
BIO_free(in);
if (!ctx)
ossl_raise(rb_eArgError, "unknown type");
}
RTYPEDDATA_DATA(self) = ctx;
return self;
}