arangors icon indicating copy to clipboard operation
arangors copied to clipboard

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

Open E-gy opened this issue 1 year ago • 3 comments

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.

E-gy avatar Aug 21 '24 09:08 E-gy

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 avatar Aug 21 '24 10:08 fMeow

Maybe like this branch: feat/tls-choice.

fMeow avatar Aug 21 '24 10:08 fMeow

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).

E-gy avatar Aug 21 '24 11:08 E-gy