Skip to content

Set proxies according to the *_PROXY environment variables #22

@hkalexling

Description

@hkalexling

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

  1. When used, it would automatically load the appropriate settings from ENV and create the corresponding HTTP::Proxy::Client objects.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions