Skip to content

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

Open
E-gy wants to merge 1 commit intofMeow:mainfrom
E-gy:reqwest-tls-feat-fwd
Open

Cargo features: support both default TLS and Rust TLS for Reqwest through feature forwarding#115
E-gy wants to merge 1 commit intofMeow:mainfrom
E-gy:reqwest-tls-feat-fwd

Conversation

@E-gy
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
Owner

fMeow commented Aug 21, 2024

Maybe like this branch: feat/tls-choice.

@E-gy
Copy link
Copy Markdown
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