Faraday: (How) is no_proxy supported?

Created on 9 Jun 2017  ·  4Comments  ·  Source: lostisland/faraday

Version 0.12.0 in the release notes says "Proxy feature now relies on Ruby URI::Generic#find_proxy and can use no_proxy ENV variable (not compatible with ruby < 2.0)". Great! However I noticed this line:

warn 'no_proxy is unsupported' if ENV['no_proxy'] || ENV['NO_PROXY']

So is no_proxy supported or not? Or maybe supported sometimes? Please fix or document this.

Most helpful comment

Using faraday 0.12.2, I am getting this output on Ruby 2.3.3 & 2.4.2 currently. Is this a regression?

When running my build on CircleCI's 2.3.3, or 2.4.2 docker image, I see this:

no_proxy is unsupported

UPDATE: Seems I am experiencing #701 which has been fixed, and there is a new release of faraday. Until @intridea loosens the faraday version constraint in oauth2 (please thumb!) we will be forking oauth2, or dealing with old faraday.

All 4 comments

Hi @JasonBarnabe,

I'm sorry about the confusion. If you check when that method is actually called, you'll see that function can only be reached if URI.parse("").respond_to?(:find_proxy) is not true (so Ruby < 2.0) or if you don't provide the url when you initialise Faraday (in which case we can't guess it for you).

So release notes don't go too much into details but simply say things as they are: we support the no_proxy automatically, but only starting from Ruby 2.0 😄

OK, thanks for the info. I did see URI.parse("").respond_to?(:find_proxy) and was wondering what that could possibly mean :)

Oh I see. Simply the method find_proxy was introduced in Ruby 2.0 so if it's not there means we're in Ruby <=1.9 😃
We preferred to check this way instead than checking the ruby version because this way it might work also for other ruby interpreters (e.g. JRuby) if they support this function, or because you can monkey-patch older versions to support it if you need

Using faraday 0.12.2, I am getting this output on Ruby 2.3.3 & 2.4.2 currently. Is this a regression?

When running my build on CircleCI's 2.3.3, or 2.4.2 docker image, I see this:

no_proxy is unsupported

UPDATE: Seems I am experiencing #701 which has been fixed, and there is a new release of faraday. Until @intridea loosens the faraday version constraint in oauth2 (please thumb!) we will be forking oauth2, or dealing with old faraday.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattmill30 picture mattmill30  ·  4Comments

ioquatix picture ioquatix  ·  4Comments

Lewiscowles1986 picture Lewiscowles1986  ·  4Comments

luizkowalski picture luizkowalski  ·  3Comments

QuinnWilton picture QuinnWilton  ·  4Comments