Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to detect if TLS support is compiled in? #392

Open
brendanlong opened this issue Apr 29, 2021 · 0 comments
Open

Best way to detect if TLS support is compiled in? #392

brendanlong opened this issue Apr 29, 2021 · 0 comments

Comments

@brendanlong
Copy link
Contributor

For Pgx, I want to attempt to upgrade connections to TLS (#391) if support is enabled, but skip STARTTLS if we can't do TLS anyway.

Right now my code to do this tries to configure TLS and catches exceptions, but I'm wondering if there's a more idiomatic way of doing this:

  let upgrade_ssl =
    try
      let config = Conduit_async.V1.Conduit_async_ssl.Ssl_config.configure () in
      `Supported (fun in_channel out_channel ->
        Conduit_async.V1.Conduit_async_ssl.ssl_connect config in_channel out_channel)
    with _ ->
      `Not_supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant