Parent

Methods

Kgio::SSLConnector

Like Kgio::SSL, but for SSL/TLS clients that connect to servers, not for SSL/TLS servers.

Public Class Methods

Kgio::SSLConnector.new(io, ssl_ctx, hostname, session = nil) view method source

Initializes an SSL/TLS client socket. Like Kgio::SSL.new, except hostname is required for verification and session may be specified as an OpenSSL::SSL::Session object.

static VALUE conn_init(int argc, VALUE *argv, VALUE self)
{
        VALUE io, ctx, hostname, session;
        SSL *ssl;

        rb_scan_args(argc, argv, "31", &io, &ctx, &hostname, &session);
        ssl = kgio_ssl_init(self, io, ctx);

        if (SSL_set_tlsext_host_name(ssl, StringValueCStr(hostname)) != 1)
                ossl_raise(eSSLError, "SSL_set_tlsext_host_name");

        if (rb_obj_is_kind_of(session, cSSLSession)) {
                SSL_SESSION *sess = DATA_PTR(session);
                if (!sess)
                        ossl_raise(eSSLSession, "no session available");
                if (SSL_set_session(ssl, sess) != 1)
                        ossl_raise(eSSLError, "SSL_set_session");
        }
        rb_ivar_set(self, iv_hostname, hostname);
        rb_ivar_set(self, iv_kgio_connected, Qfalse);

        return conn_tryconnect(self);
}

Originally generated with the Darkfish Rdoc Generator 2, modified by wrongdoc.

We love to hear from you!
Email patches (with git send-email), pull requests, questions, bug reports, suggestions, etc. to us publically at kgio@librelist.org.
To subscribe, just send any email to kgio@librelist.org, and respond to the automated confirmation message.
Do not waste bandwidth with HTML, HTML mail will not be read.
Quote only parts you're responding to and do not top post.
For sensitive topics, email us privately at kgio@bogomips.org.