eclipse/aether-core — pull request #1 by cstamas (2014-02-19 15:49:03+00:00)
Title: Handle 202 Accepted status code

Just a POC-kind of proposal.

In some cases, request server may respond with 202 Accepted code (which is perfectly legal according to HTTP RFC) meaning "am working on it, but come back later". This might happen for example with MRMs, that have to cache the whole file (and probably perform some checks like hashing it or whatnot) before they start to send the content downstream to the client (currently all MRM proxies work like this). The problem gets even worse, when you have multiple MRM proxies chained together, and ultimately the client (Aether in this case) would simply timeout.

To solve this problem, Aether might listen and honor the 202 response, which basically means, "retry in few please, am working on it".

About the patch: while this patch "works", is more like a POC: I dislike it for multiple reasons: in case of parallel download, it blocks the thread, just consuming it from the pool, instead returning it for other usage. Best solution would be to return the thread to the pool in RepositoryConnector, and make it retry later, but it would require more changes in other modules, and probably adding some info to ArtifactDownload that should be retried.