slachiewicz opened a new pull request, #1030:
URL: https://github.com/apache/maven-wagon/pull/1030

   Draft migration of the HTTP and WebDAV wagons from HttpComponents 4.x to 
5.x. **Work in progress — see "Known gaps" below; this is not merge-ready.**
   
   ## Origin of this branch
   
   The prior work was **not on the fork** — it lives on the *upstream* branch 
`apache/maven-wagon:feature/migrate-to-apache-http-client-5-x` (tip `40de5aae`, 
2026-08-09). That branch never compiled: Jenkins reported "This commit cannot 
be built" and the GHA `Verify` job failed. Its code used several HC5 APIs that 
do not exist in any 5.x release (`ServiceUnavailableRetryStrategy`, 
`ChallengeState`, `CookieSpecs`, `DefaultHttpRequestRetryHandler`, …). I reused 
it as a reference, rebased it onto current `master` (`7b4148cc`), and 
completed/repaired the migration. No duplicate open PR exists (the only open PR 
is #1028, unrelated).
   
   ## What changed
   
   - `wagon-providers/pom.xml`: dependencyManagement now 
`org.apache.httpcomponents.client5:httpclient5:5.6.5` and 
`org.apache.httpcomponents.core5:httpcore5:5.4.4`. Core5 is pinned to the 
version HttpClient 5.6.5 was built against (5.4.4), not the newer 5.5, to avoid 
an untested combination.
   - All `org.apache.http.*` imports and API calls moved to 
`org.apache.hc.client5.http.*` / `org.apache.hc.core5.http.*`, including code 
added to `master` after the old branch was cut 
(`OriginScopedHeadersInterceptor`, `DavMethods`, `HttpRoute`-less target 
resolution, `readMultiStatus`, `HttpHost` constructor order).
   - `wagon-http/pom.xml` shade config: artifact set now includes 
`httpclient5`, `httpcore5`, `httpcore5-h2`; relocations are 
`org.apache.hc.client5` → 
`org.apache.maven.wagon.providers.http.httpclient.client5` and 
`org.apache.hc.core5` → `…httpclient.core5`.
   - Migrated auth (preemptive now uses `BasicScheme.initPreemptive`), 
`RequestConfig` timeouts (`Timeout`, `setResponseTimeout`), SSL 
(`DefaultHostnameVerifier`/`NoopHostnameVerifier`), retry strategy 
(`DefaultHttpRequestRetryStrategy`), redirects, WebDAV request classes, test 
logging categories and documentation.
   - Added `WagonRedirectExec` to retain Wagon's 4.x behavior of replaying a 
PUT (303 → 307) at the redirect location.
   
   ## Branch policy / base
   
   Based on **`master`** (4.0.0-M1-SNAPSHOT), not `wagon-3.x`. Rationale: this 
changes the public shaded namespace and removes/changes published API and 
behavior, so it is a breaking change. A maintenance/patch line (3.5.4-SNAPSHOT) 
must not lead master in a breaking direction; 4.0.0-M1 gives major-version 
cover. Consequently **no forward-port is needed** and no second PR is opened. 
If the intended rule really is "maintenance line first", please confirm before 
merging — I would not put this on `wagon-3.x` as-is.
   
   ## Compatibility assessment
   
   - The shaded root package `org.apache.maven.wagon.providers.http.httpclient` 
is preserved, but the old *flat* HC4 FQCNs (e.g. 
`…httpclient.impl.client.CloseableHttpClient`) cannot be preserved: HC5's 
packages are structurally different (`…client5.http.impl.classic.*`, 
`…core5.http.*`). Consumers referencing those classes must update. This 
warrants the `breaking` label.
   - `wagon-http-shared` publishes HC5 types in its signatures 
(`AbstractHttpClientWagon#getHttpClient`, `getCredentialsProvider`, 
`getAuthCache`, `execute(HttpUriRequest)`, `BasicAuthScope#getScope`, 
`WagonRedirectStrategy`, …) — source/binary incompatible for consumers 
compiling against 4.x internals.
   - Removed `StandardServiceUnavailableRetryStrategy`: HC5 has no 
`ServiceUnavailableRetryStrategy`. The 
`maven.wagon.http.serviceUnavailableRetryStrategy.*` properties are therefore 
inert.
   - Legacy `ConfigurationUtils` params with no HC5 `RequestConfig` equivalent 
are consumed but ignored: `http.connection.stalecheck`, 
`http.route.local-address`, `http.protocol.reject-relative-redirect`, 
`http.protocol.handle-uri-normalization`.
   - `HttpRequestRetryHandler` is replaced by `HttpRequestRetryStrategy` (fully 
qualified custom-class property now needs an HC5 strategy implementation).
   - HC5 does not send the deprecated `Proxy-Connection` header; the TCK proxy 
assertion now checks that the proxy actually received the request.
   
   ## Verification
   
   `JAVA_HOME=$HOME/.sdkman/candidates/java/17.0.20-amzn`:
   
   - `mvn -q -B -N spotless:check` → **PASS**
   - `mvn -q -B -pl 
wagon-providers/wagon-http-shared,wagon-providers/wagon-http,wagon-providers/wagon-webdav-jackrabbit
 -am test`:
     - `wagon-http-shared`: all tests **PASS**
     - `wagon-http`: 308 tests, 0 failures, **12 errors**, 2 skipped (see below)
     - `wagon-webdav-jackrabbit` (run separately): 78 tests, 0 failures, **2 
errors**
   - Files affected compile cleanly (`test-compile` PASS for all three modules).
   
   ### Known gaps (blockers for merge)
   
   1. **10 errors** (`testRedirectPutFromStream{Relative,Full}Url` in 
`HttpWagonTest`, `HttpsWagonTest`, both preemptive variants, and 
`WebDavWagonTest`): HC5's `RedirectExec` refuses to replay a non-repeatable 
stream entity on redirect. Wagon 4.x replayed it. Preserving this would require 
buffering the stream or a custom exec chain; not done here.
   2. **2 errors** (`HttpWagonTest.testSecuredPutFromStream`, 
`HttpsWagonTest...`): same root cause — HC5 will not retry a non-repeatable 
entity after a 401 challenge.
   3. **2 errors** (`HugeFileDownloadTest`): `java.io.IOException: No space 
left on device` in this sandbox; unrelated to the migration (needs a re-run 
with more disk).
   
   The pre-existing apache branch's CI failure is thus understood and most of 
the migration is repaired, but items 1–2 are genuine behavior gaps that need a 
decision (accept HC5 semantics and update the TCK, or implement entity 
buffering/replay) before this can leave draft.
   
   ## Checklist
   
   - [ ] Decide policy on non-repeatable PUT streams on redirect/auth retry
   - [ ] Re-run `HugeFileDownloadTest` with free disk space
   - [ ] Consider raising `httpcore5` to 5.5 once httpclient5 supports/tests it
   - [ ] Review whether `wagon-3.x` should get anything (recommendation: no)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to