seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.79k stars 1.1k forks source link

Support arbitrary proxy #1321

Open trinity-1686a opened 3 years ago

trinity-1686a commented 3 years ago

this might be heavily related/partly redundant with #39 depending on how this issue get fixed, feel free to close this issue if you consider it close enough to be considered a duplicate.

I'd like to have a way to use an arbitrary proxy protocol. It could be implemented by allowing the user to provide a Fn(&str, u16) -> Read + Write function or something similar (probably with more async I guess). This would allow to setup a connection through any kind of proxy, provided the user write the code to actually contact that proxy. My use case would be to use Reqwest with Arti, a Rust implementation of Tor, but a generic approach like this would help with supporting any kind of transport layer (arbitrary proxy, unix socket), either out of reqwest, or in it.

kevincox commented 1 month ago

I would also like to have something like this precisely for handling .onion requests with Arti. It seems right now you could handle this by spawning the Atri` socks proxy as a subprocess and pointing reqwest at this but it is much more brittle and messy than it would be if it could be done in-process.