prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
311 stars 113 forks source link

Use a single TLS implementation #308

Open khanage opened 11 months ago

khanage commented 11 months ago

Currently native-tls is set as a default feature, but selecting a different tls implementation requires default-features = false in your Cargo.toml.

This PR will select one of the alternatives in alphabetical order, so that if you ask for features = ["vendored-openssl", "rustls", "native-tls"] you will get the implementation for rustls.

This solves a similar issue to #237, but uses cfg-if in order to just surface a single implementation where necessary.

tomhoule commented 11 months ago

I wrote my reaction to the opinions in https://github.com/prisma/tiberius/pull/237#issuecomment-1700892327 — but tl;dr I like the approach in this PR.

esheppa commented 11 months ago

It could be interesting to add a test in the github actions to ensure this behavior isn't broken later (cargo hack check --feature-powerset with a few feature exclusions is also nice for this)

khanage commented 11 months ago

Thanks @tomhoule I've updated documentation and also noticed that we might not want any TLS implementation by looking through #305 so I've added a check to see if native-tls is on at all.

tomhoule commented 11 months ago

There are test errors in CI, but they look unrelated.