ureq icon indicating copy to clipboard operation
ureq copied to clipboard

Respect `NO_PROXY` environment variable.

Open zicklag opened this issue 2 years ago • 14 comments

With the try_proxy_from_env(true) option, ureq correctly reads the HTTP[S]_PROXY environment variables, but it doesn't honor the NO_PROXY environment variables. Also, it's not possible to efficiently implement from outside of ureq, because you would have to create a new Agent for each request to a different domain, instead of being able to share the same agent state among all domains.

zicklag avatar Oct 04 '23 00:10 zicklag

Zicklag @.***> wrote: > NO_PROXY environment variables. Also, it's not possible to > efficiently implement from outside of ureq, because you would have to > create a new Agent for each request to a different domain, instead of > being able to share the same agent state among all domains.

Also redirects that had different proxy needs wouldn't work.

mcr avatar Oct 04 '23 13:10 mcr

@zicklag

but it doesn't honor the NO_PROXY environment variables.

I know very little about proxies. PR welcome.

Also, it's not possible to efficiently implement from outside of ureq, because you would have to create a new Agent for each request to a different domain, instead of being able to share the same agent state among all domains.

Agent is reusable for multiple requests.

@mcr

Also redirects that had different proxy needs wouldn't work.

Not sure I follow. Do you mean there should be different proxy settings per request host?

algesten avatar Oct 05 '23 21:10 algesten

Martin Algesten @.***> wrote: >> Also redirects that had different proxy needs wouldn't work.

> Not sure I follow. Do you mean there should be different proxy settings per request host?

The point of NO_PROXY is that it does not use the proxy for certain hosts. So, in effect, yes, there are different proxy settings (namely: none) for some hosts.

mcr avatar Oct 05 '23 22:10 mcr

ureq 3.x needs support for this. We should do all the options curl does:

https://github.com/curl/curl/blob/master/docs/libcurl/opts/CURLOPT_NOPROXY.md

algesten avatar Aug 25 '24 20:08 algesten