Backport system proxy credentials to Resolver 1.9.x
Adapted the proxy-credential fix for the Java 8 and HttpClient 4 transport stack while preserving explicit Resolver authentication precedence and default behavior.
apache/maven-resolver · #2149
Compatibility backport
Authenticated system proxies now work in the Resolver 1.9.x lineage used by Maven 3.9.16, with route-scoped credentials and redirect isolation.
Problem
Resolver 1.9.x could read system proxy hosts and ports under the existing opt-in but ignored proxyUser and proxyPassword, causing HTTP 407 for the Maven 3.9.16 environment that originally reported the problem.
Approach
Adds a 1.9.x-compatible proxy authentication strategy that selects matching credentials for the route's target protocol first, falls back to the opposite protocol when appropriate, recognizes default ports, and clears system-derived Basic authentication when redirects change the proxy or target protocol.
Impact and scope
- Delivers authenticated system-proxy support to the Resolver lineage used by the reported Maven 3.9.16 installation rather than limiting the fix to Resolver 2.x.
- Keeps proxy credentials isolated from repository origins and preserves explicit Resolver proxy credentials as the higher-priority source.
- Handles HTTP-to-HTTPS redirects through the same proxy without carrying stale HTTP Basic authentication into the CONNECT challenge.
- Leaves the system-properties integration disabled by default, changes no public API, and documents 1.9.28 as the first maintenance release intended to include the behavior.
Validation
- The new regression cases failed before the runtime fix, establishing the HTTP 407 and credential-selection defects on the maintenance branch.
- The complete 18-module verification passed 1,057 tests with no failures or errors; the integration profile passed 36 integration tests plus one Invoker build.
- The full HTTP transport class passed 89 tests covering transfers, HTTPS CONNECT, explicit precedence, origin isolation, default ports, protocol preference and fallback, and redirect cleanup.
- An isolated HttpClient 4.5.14 loopback test confirmed that an HTTP-to-HTTPS redirect sends no HTTP credentials on CONNECT and selects HTTPS credentials only after a proxy challenge. The hosted matrix passed, an Apache member approved the final revision, and the merge commit credits Goutam Adwant.