Tls module

tls_connect

procedure · 1 overloadSource

Runs the client handshake over reader and writer and checks the server's certificate against server_name (which is also sent as the SNI name; "" sends none, and with verify_name off the name is not checked). On success the stream owns the connection: close closes it. On an error nothing is closed, the connection is the caller's to close.

tls_connect :: (
    config: *Tls_Config,
    reader: Io.Reader,
    writer: Io.Writer,
    server_name: string
) -> (*Tls_Stream, Tls_Error)

Runs the client handshake over reader and writer and checks the server's certificate against server_name (which is also sent as the SNI name; "" sends none, and with verify_name off the name is not checked). On success the stream owns the connection: close closes it. On an error nothing is closed, the connection is the caller's to close.

Parameters

config: *Tls_Config
an initialised config (tls_config_init).
reader: Io.Reader
where the bytes from the server come from.
writer: Io.Writer
where the bytes to the server go.
server_name: string
the host name to check the certificate against and send as SNI.

Returns

See also