sakshichitnis27 opened a new pull request, #2242:
URL: https://github.com/apache/maven-resolver/pull/2242

   Implement retries in the Jetty transporter
   
   The Jetty HttpClient has no retry hook, so `JettyTransporter` now retries 
`HEAD`, `GET` and `PUT` requests itself, using the existing 
`aether.connector.http.retryHandler.*` settings (`count`, `interval`, 
`intervalMax`, `serviceUnavailable`), the same way the Apache and JDK 
transporters do.
   
   - Responses with a status in `serviceUnavailable` (429 and 503 by default) 
are retried after a linearly growing delay. A `Retry-After` header (seconds or 
HTTP date) is used instead if present. The delay is capped at `intervalMax`.
   - I/O failures (e.g. a connection closed by the server) and timeouts are 
retried immediately. Failures that are unlikely to go away on their own 
(unknown host, connection refused, no route, SSL errors) are not retried, which 
mirrors Apache's `DefaultHttpRequestRetryHandler`.
   - Cancelled transfers and the redirects refused by `InsecureRedirectGuard` / 
`SameAuthorityRedirectGuard` are not retried. The guards now abort with a small 
`RedirectRefusedException` (still an `IOException`) so they can be told apart.
   - Retries are logged through `HttpTransporter.logRetry` / 
`logImmediateRetry`, like for the other transporters.
   - `implPeek` now unwraps the `ExecutionException` like `implGet` and 
`implPut` already do, so a failed `peek` surfaces the underlying `IOException`.
   - Removed "Does not support configurable retries" for Jetty from 
`transporter-known-issues.md`.
   
   Only the time until the response headers arrive is covered, as for the other 
transporters. A download that fails halfway through the body is not retried.
   
   Tests:
   - Enabled the retry tests from `HttpTransporterTest` for Jetty 
(`supportsRetryLogging()` and the `@Disabled` overrides are gone). Before this 
change 11 of them failed on `master`.
   - Added `JettyRetryHandlerTest` (retry limit, non-retriable failures, 
`Retry-After` as seconds/date/invalid, delay cap).
   - The shared retry tests only use `HEAD`, so I added `GET` and `PUT` cases 
to `JettyTransporterTest` (503 then success, closed connection then success, 
giving up after the retry count). These fail if retries are switched off.
   
   Verified with `mvn -pl maven-resolver-transport-jetty verify` (143 tests, 0 
failures, 5 skipped as before).
   
   This closes #2239
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [ ] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
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