Skip to content

[CXF-9218]Respect configured ProxySelector instead of hard-wiring sys…#3154

Merged
ffang merged 1 commit into
apache:mainfrom
ffang:CXF-9218
May 29, 2026
Merged

[CXF-9218]Respect configured ProxySelector instead of hard-wiring sys…#3154
ffang merged 1 commit into
apache:mainfrom
ffang:CXF-9218

Conversation

@ffang
Copy link
Copy Markdown
Contributor

@ffang ffang commented May 28, 2026

…tem proxy properties

Summary

ProxyFactory was reading http.proxyHost, http.proxyPort, and http.nonProxyHosts
directly from system properties at construction time, bypassing Java's ProxySelector
mechanism entirely. This prevented applications from using custom ProxySelector
implementations — for example, wrapping sun.net.spi.DefaultProxySelector to selectively
bypass the proxy for specific hosts.

The fix removes the system-property reading from ProxyFactory and delegates to
ProxySelector.getDefault() instead. When no custom ProxySelector is installed the
behaviour is identical to before (DefaultProxySelector reads the same system properties
internally). When a custom ProxySelector is installed it is now consulted as expected.

The explicit HTTPClientPolicy.setProxyServer(...) path is unaffected.

Behaviour notes

  • Default behaviour unchangedDefaultProxySelector reads http.proxyHost /
    http.proxyPort / http.nonProxyHosts exactly as before.
  • Both HttpClientHTTPConduit and URLConnectionHTTPConduit benefit from this fix.

Copy link
Copy Markdown
Member

@reta reta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much simpler, thanks @ffang !

@ffang ffang merged commit 2e1fd49 into apache:main May 29, 2026
5 checks passed
@ffang ffang deleted the CXF-9218 branch May 29, 2026 16:01
@ffang
Copy link
Copy Markdown
Contributor Author

ffang commented May 29, 2026

Thanks @reta !

ffang added a commit that referenced this pull request May 29, 2026
…tem proxy properties (#3154)

(cherry picked from commit 2e1fd49)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants