The [protocol]_PROXY and NO_PROXY environment variables are commonly used to configure proxies in applications. Wget and Emacs are two examples. Python's requests library also respects HTTP_PROXY and HTTPS_PROXY out of the box.
It would be great if we could have a helper method like HTTP::Proxy::Client.use_env that would do the followings
- When used, it would automatically load the appropriate settings from ENV and create the corresponding
HTTP::Proxy::Client objects.
- It would then monkey-patch the
HTTP::Client class in the standard library so that the clients use the appropriate proxies in all requests.
Here's an example implementation I used in my project. I will be happy to submit a PR if you think it's a good idea.
The
[protocol]_PROXYandNO_PROXYenvironment variables are commonly used to configure proxies in applications. Wget and Emacs are two examples. Python'srequestslibrary also respectsHTTP_PROXYandHTTPS_PROXYout of the box.It would be great if we could have a helper method like
HTTP::Proxy::Client.use_envthat would do the followingsHTTP::Proxy::Clientobjects.HTTP::Clientclass in the standard library so that the clients use the appropriate proxies in all requests.Here's an example implementation I used in my project. I will be happy to submit a PR if you think it's a good idea.