Conversation
iMacTia
left a comment
There was a problem hiding this comment.
Ah for a moment I thought this was going to be Go code 🙄!
Looks good, but why not relying on the out-of-the-box method provided by Ruby? What are the main differences?
|
I listed the 3 benefits in the original PR message above. Basically, the code more correctly implements the environment vars, and it should be more efficient in long running scripts with the way it checks uri hosts against I'm okay leaving this PR here until we're sure we want it. I extracted #1063 out of it too. |
|
I have no doubts this can actually be better than the Ruby solution, I'm just a bit unconfident with reinventing the wheel (and then maintaining it). Is there any chance we can propose a fix on the Ruby implementation itself? Too audacious? |
I started poking at the proxy code, and then decided trying to implement the
net/http/httpproxypackage in Go. Basically, I thought what it'd be like to replace 14 lines of code with my own version in 326 lines (plus docs):faraday/lib/faraday/connection.rb
Lines 587 to 600 in e4b4b97
Three benefits:
no_proxyis correctly handled in cases whereURI#find_proxydon't exist. I don't know what versions are affected, so this may be a moot point.#proxy_forcalls, especially with lots ofno_proxyentries.https_proxyIs it worth it? I'm not really sure. But it was fun to write :)