-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[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
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
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
Details:
use_proxy?
method with URI::Generic.use_proxy? to use already existing functionality for handling theno_proxy
string, which can include a list of comma- or space-separated elements.p_no_proxy
variable 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_client
is 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_proxy
but 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_proxy
was 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_proxy
value, I could have kept a string in the setter method, and transformed it to Array for theas_json
method.🔄 Types of changes
no_proxy
value is considered as an Array directly in its setter methodno_proxy
value 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::Generic
andNet::HTTP
no_proxy
to handle lists per WebDriver specUpdated serialization and Firefox profile to treat
no_proxy
as a listEnhanced and expanded unit tests for proxy and
no_proxy
handlingRemoved deprecated and redundant proxy code
Changes walkthrough 📝
proxy.rb
Refactor and spec-compliant handling of no_proxy in Proxy class
rb/lib/selenium/webdriver/common/proxy.rb
no_proxy=
to parse strings into lists per specno_proxy
as a listprofile.rb
Update Firefox profile to use list-based no_proxy
rb/lib/selenium/webdriver/firefox/profile.rb
network.proxy.no_proxies_on
using joined list fromno_proxy
no_proxy
default.rb
Refactor HTTP proxy logic to use stdlib and support no_proxy lists
rb/lib/selenium/webdriver/remote/http/default.rb
URI::Generic
for proxy logicno_proxy
use_proxy?
logic in favor of stdlibproxy_spec.rb
Update and expand Proxy spec for list-based no_proxy
rb/spec/unit/selenium/webdriver/proxy_spec.rb
no_proxy
as a listno_proxy
separators and formatsdefault_spec.rb
Expand HTTP Default spec for robust no_proxy handling
rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb
no_proxy
environment variable handlingno_proxy
default.rbs
Remove deprecated proxy method signature from RBS
rb/sig/lib/selenium/webdriver/remote/http/default.rbs
use_proxy?
method