Skip to content

SSLPreferred

[Source]

Prefer SSL but fall back to plaintext if the server refuses. The driver sends an SSLRequest during connection setup. If the server responds 'S', the TLS handshake proceeds normally. If the server responds 'N' (refusing SSL), the connection continues as plaintext — equivalent to PostgreSQL's sslmode=prefer.

A TLS handshake failure (server accepts but the handshake itself fails) is NOT retried as plaintext — pg_session_connection_failed fires, matching PostgreSQL's sslmode=prefer behavior.

The SSLContext controls certificate and cipher configuration. Users must use "ssl/net" in their own code to create an SSLContext val:

let sslctx = recover val
  SSLContext
    .> set_client_verify(false)
    .> set_server_verify(false)
end
SSLPreferred(sslctx)
class val SSLPreferred

Constructors

create

[Source]

new val create(
  ctx': SSLContext val)
: SSLPreferred val^

Parameters

Returns


Public fields

let ctx: SSLContext val

[Source]