-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] Leverage existing URI::Generic and Net::HTTP code for proxy handling #15782
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
53f486d to
1505859
Compare
1505859 to
ea9bc69
Compare
f7dc9a7 to
1931205
Compare
|
Wow, thanks for the thorough description. I don't understand what this is trying to fix, though. The issue you referenced was closed in 2018. I'm reluctant to make any changes that might break what users are doing now. |
This all started with the The switch from the old custom version to the generical one is closer to the specifications we can found over the internet about the format of the
For example, if we want to keep the global wildcard PS: The issue I referenced is only a related topic but not the reason why I wrote this Pull Request. |
1543aea to
1931205
Compare
Details: - Replaced custom use_proxy? method with URI::Generic.use_proxy? to use already existing functionality for handling the `no_proxy` string, which can include a list of comma- or space-separated elements. - Take advantage of the `p_no_proxy` variable in Net::HTTP to maintain environment variables related to proxy settings. - Note: With this change, wildcards are no longer usable to bypass the proxy due to limitations in the existing proxy code. Related to SeleniumHQ#5004
1931205 to
d327ccb
Compare
User description
Details:
use_proxy?method with URI::Generic.use_proxy? to use already existing functionality for handling theno_proxystring, which can include a list of comma- or space-separated elements.p_no_proxyvariable in Net::HTTP to maintain environment variables related to proxy settings.🔗 Related Issues
Related to #5004
💥 What does this PR do?
It changes the way the
new_http_clientis built to leverage what is already done in URI::Generic and Net::HTTP about the condition to use the proxy or not.🔧 Implementation Notes
I tried to look up for a standardized way of using
no_proxybut didn't find any. It seems like we are in the jungle and everyone has its own opinion.However, the most common format I have found for
no_proxywas a comma-separated list of strings:Also, I used only components that are already part of the project and things could been done differently.
💡 Additional Considerations
If wildcards need to be allowed, then it would most likely implies a change on URI::Generic first. However, I don't get why it could be useful to have it since we could use no proxy instead.
As alternative for the
no_proxyvalue, I could have kept a string in the setter method, and transformed it to Array for theas_jsonmethod.🔄 Types of changes
no_proxyvalue is considered as an Array directly in its setter methodno_proxyvalue can be passed as a space-separated elements, or comma-plus-space-separated elements*) is not supported anymorePR Type
Bug fix, Enhancement
Description
Refactored proxy handling to use
URI::GenericandNet::HTTPno_proxyto handle lists per WebDriver specUpdated serialization and Firefox profile to treat
no_proxyas a listEnhanced and expanded unit tests for proxy and
no_proxyhandlingRemoved deprecated and redundant proxy code
Changes walkthrough 📝
proxy.rb
Refactor and spec-compliant handling of no_proxy in Proxy classrb/lib/selenium/webdriver/common/proxy.rb
no_proxy=to parse strings into lists per specno_proxyas a listprofile.rb
Update Firefox profile to use list-based no_proxyrb/lib/selenium/webdriver/firefox/profile.rb
network.proxy.no_proxies_onusing joined list fromno_proxyno_proxydefault.rb
Refactor HTTP proxy logic to use stdlib and support no_proxy listsrb/lib/selenium/webdriver/remote/http/default.rb
URI::Genericfor proxy logicno_proxyuse_proxy?logic in favor of stdlibproxy_spec.rb
Update and expand Proxy spec for list-based no_proxyrb/spec/unit/selenium/webdriver/proxy_spec.rb
no_proxyas a listno_proxyseparators and formatsdefault_spec.rb
Expand HTTP Default spec for robust no_proxy handlingrb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
no_proxyenvironment variable handlingno_proxydefault.rbs
Remove deprecated proxy method signature from RBSrb/sig/lib/selenium/webdriver/remote/http/default.rbs
use_proxy?method