ureq icon indicating copy to clipboard operation
ureq copied to clipboard

Automatically pick up SOCKS configuration from environment variables

Open Shnatsel opened this issue 4 years ago • 5 comments

As discussed in #298, HTTP and SOCKS proxy configuration is not currently detected automatically based on environment variables. I feel this goes against the crate's stated goals somewhat, since the README says

Ureq's first priority is being easy for you to use.

and most other Rust clients that support SOCKS also automatically pick up its configuration from an environment variable.

Shnatsel avatar Feb 15 '21 19:02 Shnatsel

This makes sense to me. 👍🏻

jsha avatar Feb 15 '21 22:02 jsha

Sure. Let's do it.

algesten avatar Feb 21 '21 08:02 algesten

Which environment variables should be supported http_proxy, https_proxy? More: https://gist.github.com/yougg/5d2b3353fc5e197a0917aae0b3287d64 ? (In case I find time to look into it, knowing which environment variables will help :) )

markmmm avatar Jul 19 '21 00:07 markmmm

It looks like https://crates.io/crates/env_proxy has already done research on how folks expect these env vars to work, so that might be a good place to start.

njsmith avatar Jul 19 '21 02:07 njsmith

It looks like https://crates.io/crates/env_proxy has already done research on how folks expect these env vars to work, so that might be a good place to start.

If we were to use this crate, we have to have a URL in order to get the correct proxy from env vars(using env_proxy::for_url_str), which in our case is given in Request::new. Can(or should) there be a way to change the Agent's config when instantiating a new Request?

One other way I can think of is we store all the possible proxies in Agent and choose to use the correct one in Unit::connect_socket.

If this issue is still free, I want to try and take a stab at it. May need some guidance :)

Dolpheyn avatar Oct 03 '21 00:10 Dolpheyn

I'm interested in this, @Dolpheyn did you give it a go?

bemug avatar Nov 08 '22 09:11 bemug

Anyone looking at this? Can't be that hard to implement.

rruckley avatar May 30 '23 05:05 rruckley

Yeah, I'm lucky I never had to work behind proxies, so from what I know no one picked it up.

algesten avatar Jun 07 '23 09:06 algesten

I see that #649 is merged, is this problem solved?

(github might not have done the auto close without a "close" keyword in the pr?)

toymil avatar Nov 21 '23 10:11 toymil

This was fixed in 2.8.0 (and I just released 2.9.0).

I believe this is done.

algesten avatar Nov 21 '23 13:11 algesten