reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

`trust-dns-optional` crate feature

Open vmagro opened this issue 4 years ago • 4 comments

This feature allows one to enable use of the trust-dns resolver, while not setting it as the default. This is useful in large monorepo codebases where trust-dns is only desirable in a small number of callsites, but feature sets are global.

vmagro avatar Dec 22 '21 14:12 vmagro

@seanmonstar is there anything blocking this that I can resolve?

vmagro avatar Mar 04 '22 15:03 vmagro

@seanmonstar can you please review this? Thanks!

vmagro avatar Apr 13 '22 00:04 vmagro

Oh, I see what you're wanting to do... Hm. I'd say the best solution would be to fix reqwest so that enabling the feature doesn't automatically use it on all clients. "Optional" features in this way seem very different than the normal usage.

Or, if we made the resolver completely pluggable, than we wouldn't need special knowledge of trust-dns...

seanmonstar avatar Apr 13 '22 01:04 seanmonstar

I'd say the best solution would be to fix reqwest so that enabling the feature doesn't automatically use it on all clients

That was another option that I considered, but it is a breaking change of behavior for existing users. IMO it does make sense and I'd be happy to make that change here.

My only other idea is gross: a separate feature that would set the default to trustdns that is enabled as a default feature, but only takes effect if trustdns is enabled, followed by additional feature(s) to explicitly set the default resolver. That way if a user enables the trustdns feature, then by default they get that as the default client resolver unless they explicitly turn off default-features...

vmagro avatar Apr 14 '22 19:04 vmagro