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

Cargo features: support both default TLS and Rust TLS for Reqwest through feature forwarding #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

E-gy
Copy link

@E-gy E-gy commented Aug 21, 2024

With this change, arangors can support Rust TLS out of the box. Default configuration is effectively unchanged, using default TLS.

To support Rust TLS as TLS provider for reqwest, now all that has to be done is adding arangors as dependency with flags:

arangors = { ..., default-features = false, features = ["rocksdb", "reqwest_async", "reqwest_rustls-tls"]}

Native (Default) TLS can be forced manually in a similar manner with

arangors = { ..., default-features = false, features = ["rocksdb", "reqwest_async", "reqwest_default-tls"]}

Of course, the TLS provider can be switched independently of blocking/async mode.

The way to handle feature gate forwarding was inspired by elasticsearch.

@fMeow
Copy link
Owner

fMeow commented Aug 21, 2024

Thanks for your PR!!

But I think that using feature gate to pass down feature is not necessary. Rust's feature is addtive, which means that we can just declare reqwest dependency in top level crate and enable whatever features we want without touching arangors.

But yes, we have to disable reqwest's default features in arangors.

@fMeow
Copy link
Owner

fMeow commented Aug 21, 2024

Maybe like this branch: feat/tls-choice.

@E-gy
Copy link
Author

E-gy commented Aug 21, 2024

Indeed! Though the literal way it is on feat/tls-choice right now, it won't work "out-of-the-box" - i.e. the end users have to add top level request version="*" with either features = ["default-tls"] or features = ["rustls-tls"].

Though suffice to add reqwest/default-tls to default features (then once again requiring default-features = false for rustls).

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.

2 participants