-
Notifications
You must be signed in to change notification settings - Fork 983
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
Socks proxy support for net/http #992
base: main
Are you sure you want to change the base?
Conversation
While the original patch passed my integration tests (technoweenie/faraday-live#7), I didn't like how the username and password were set: TCPSocket.socks_username = proxy[:user] if proxy[:user]
TCPSocket.socks_password = proxy[:password] if proxy[:password]
Net::HTTP::SOCKSProxy(proxy[:uri].host, proxy[:uri].port) A global (or at-best, a thread local) socks username/pass doesn't seem very safe. I rewrote this to use the socksify maintainer's PR to support proxy authentication: astro/socksify-ruby#33 |
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.
Nice implementation and great opportunity to also rewrite some old code in a much better way.
Ignoring Code Climate issues for the reasons explained in the comment above.
For future visitors, this change is technically good to go but is waiting for astro/socksify-ruby#33 to be merged. |
This takes forever 😅 |
Cross-dependencies with other libraries 🙈. |
This patches in SOCKS proxy support for the net/http adapter, using this snippet by @yarafan: #787 (comment).
I don't want to add the socksify gem as a required gem dependency for faraday. The net/http adapter attempts to load it, but only complains if you try to use a socks proxy:
This behavior is difficult to test with rspec, so I tested this in the integration test suite faraday-live.
Fixes #787