hyper-rustls icon indicating copy to clipboard operation
hyper-rustls copied to clipboard

Forwarding the `rustls` provider settings

Open LecrisUT opened this issue 1 year ago • 7 comments

It would be good to use a design of the features similar to axum-server, i.e.:

tls-rustls = ["tls-rustls-no-provider", "rustls/aws-lc-rs"]
tls-rustls-no-provider = [...]

This would make it easier to forward these options down the chain of dependencies.

LecrisUT avatar Sep 16 '24 12:09 LecrisUT

It is pretty unclear what you are trying to achieve. What's the use case here?

djc avatar Sep 17 '24 09:09 djc

The issue is with propagationg the choice of rustls/ring vs rustls/aws-lc-rs that needs to be propagated to all dependencies until the leaf package. E.g. in atuin it has dependencies on metrics-exporter-prometheus and axum-server, the former having a dependency on hyper-rustls. axum-server allows to import the tls-rustls-no-provider feature in which case you can manually add rustls/aws-lc-rs or rustls/ring avoiding conflicts of each package having a different default tls provider. In the case of atuin after rustls switched the default provider, their CI is no longer buildable and it blocks the upgrade path because of this.

LecrisUT avatar Sep 17 '24 09:09 LecrisUT

So why can't you depend on hyper-rustls with default-features = false? hyper-rustls unconditionally depends on rustls already, so the setup in axum-server doesn't necessarily translate well to this crate.

djc avatar Sep 17 '24 09:09 djc

Of course that's possible, but then we would have to manage the non-aws-lc-rs feature, i.e. we would have to manually inlcude ["http1", "tls12", "logging"]. The proposal is to move all of the non-provider features into a group so that downstream can more easily compose it.

LecrisUT avatar Sep 17 '24 10:09 LecrisUT

Honestly I don't think this makes much sense. Just repeat the features downstream where it makes sense.

djc avatar Sep 17 '24 12:09 djc

This feels like a place where cargo could be more helpful, allowing expressing something like "defaults minus feature X". In absence of that, and for a crate like hyper-rustls where the default features seldom change, I think I concur with Djc that repeating the features you want from the default set, without the ones you don't, is likely the best solution.

cpu avatar Sep 17 '24 16:09 cpu

This feels like a place where cargo could be more helpful, allowing expressing something like "defaults minus feature X".

That would be:

  • https://github.com/rust-lang/cargo/issues/3126

djc avatar Sep 17 '24 16:09 djc