rust-s3 icon indicating copy to clipboard operation
rust-s3 copied to clipboard

Don't depend on reqwest

Open tomkarw opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. I recently tried to remove reqwest as a dependency from a project (using the lower-level hyper::Client which was already required instead). After doing so, I noticed that reqwest is still included in the dependency tree due to its use in rust-s3.

Using reqwest (which relies on hyper either way) seems a suitable choice for application code, but hyper itself might mean fewer dependencies for a projects like mine.

Describe the solution you'd like Remove reqwest dependency and replace its usages with underlying hyper and rustls.

Describe alternatives you've considered Leaving it as it is and living with extra dependencies.

Additional context I'd be happy to implement this myself, just let me know if you'd be interested. If yes, I'd try to code it straight away.

tomkarw avatar Jul 25 '22 21:07 tomkarw

@tomkarw I like the idea, reqwest is pretty heavy, it might be a lot of work tough, I’m not sure how hyper works with tokio, which is the feature that is pulling reqwest in. I think you can get rid of reqwest by using the sync feature with default features off. That should pull attohttpc instead of reqwest.

Regarding I’d be happy to take a PR removing it

durch avatar Jul 26 '22 07:07 durch

I have some experience with doing exacltly the reqwest -> hyper transition. I also proposed very similar change to another project that suffered from the same issue https://github.com/open-telemetry/opentelemetry-rust/issues/843.

You can assign this issue to me and I'll work on it.

tomkarw avatar Jul 26 '22 15:07 tomkarw

It would seem that merging https://github.com/durch/rust-s3/pull/234 first, might simplify, or even remove the need for this work.

I'll wait and see how that PR proceeds before working on this.

tomkarw avatar Jul 26 '22 18:07 tomkarw

I've given up on reusing the client for now, I'm gonna look into using pure hyper, but can't commit to any timelines

durch avatar Sep 25 '22 15:09 durch

You can let me pick this up if you want. I'll be happy to do so.

tomkarw avatar Sep 25 '22 18:09 tomkarw

For sure, go for it!

durch avatar Sep 25 '22 20:09 durch

@durch I did it, but now that I see it, I'm not sure if it's worth it. Your call.

tomkarw avatar Sep 30 '22 00:09 tomkarw

One downside to this is that hyper doesn't respect proxy settings via environment variables and I believe reqwest does. I haven't tested rust-s3 with reqwest but I'm currently using rust-s3 explicitly because the attohttpc variant respects those environment variables out of the box and they're not supported by aws-sdk (nor rusoto) and it was easier to switch to rust-s3 than figure out how to support those settings in a robust way. Whether that is something you want to support is another question, but it is something to keep in mind.

Obviously, you can add support to a hyper implementation but it doesn't come out of the box as far as I'm aware.

drewkett avatar Oct 29 '22 17:10 drewkett