-
Notifications
You must be signed in to change notification settings - Fork 980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy selector #1062
base: main
Are you sure you want to change the base?
Proxy selector #1062
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth it? I'm not really sure. But it was fun to write :)
I just hope you don't expect me to maintain this 😂. Wouldn't know where to start from!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/httpproxy
package 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_proxy
is correctly handled in cases whereURI#find_proxy
don't exist. I don't know what versions are affected, so this may be a moot point.#proxy_for
calls, especially with lots ofno_proxy
entries.https_proxy
Is it worth it? I'm not really sure. But it was fun to write :)