TooTallNate / node-proxy-agent

Maps proxy protocols to `http.Agent` implementations
285 stars 69 forks source link

Add support for env vars by default (#11) #16

Closed jackjocross closed 6 years ago

jackjocross commented 6 years ago

If you declare a new ProxyAgent() without passing any opts, proxy-from-env will be used to determine whether to use a proxy or the default http.Agent.

In order to support the NO_PROXY environment variable, I had to add some logic in the connect function to resolve the proxy for each request if initial opts weren't passed in.

I am not very familiar with http.Agent, but tried using agent.addRequest after reading through the source code. Let me know if you think I should take a different approach to anything in this PR.

jackjocross commented 6 years ago

@TooTallNate let me know if there are any other changes I should make!

TooTallNate commented 6 years ago

Really good stuff @crosscompile! Thank you.

pimterry commented 6 years ago

I'd love to use this, but it doesn't look like it's actually been released. Any chance you could publish this sometime soon @TooTallNate?

nhooyr commented 3 years ago

Thank you for adding this @crosscompile! <3

Going to be super easy to support http proxies in https://github.com/cdr/code-server now!