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

client: feature gate tls cert store #994

Merged
merged 4 commits into from
Feb 2, 2023

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Jan 30, 2023

Currently, the clients will include dependencies for both webpki and native certificate store which can be configured at runtime but that leads to a bigger dependency tree.

IIRC, I did it like this to avoid having "mutually exclusive feature" but I looked at the reqwest API and having these APIs behind a feature flag looks clean to me.

No default features implies -> no TLS

@niklasad1 niklasad1 requested a review from a team as a code owner January 30, 2023 13:09
#[cfg(not(feature = "__tls"))]
Some("http") => Client::new(),
#[cfg(all(feature = "__tls", feature = "native-tls", feature = "webpki-tls"))]
Some("https") | Some("http") => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for simplicity, just use connector based on the feature flag and yes the https connector is a bit slower on plain http than http connector.

native-tls = ["hyper-rustls/native-tokio", "__tls"]
webpki-tls = ["hyper-rustls/webpki-tokio", "__tls"]

__tls = ["hyper-rustls"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this for clarity, but just noting that as it stands, hyper-rustlswill automatically be bought in when native-tls or webpki-tls is enabled without needing it :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah but it's useful to reference this in the code, I see!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM! (personally I have no opinion or issue with the feature name choices!)

@niklasad1 niklasad1 merged commit f6f4a08 into master Feb 2, 2023
@niklasad1 niklasad1 deleted the na-client-feature-gate-tls-cert-store branch February 2, 2023 09:05
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

Successfully merging this pull request may close these issues.

3 participants