You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2019/10/15 15:53:26 UTC
[maven-wagon] branch redirect-iae updated: cheap fix, PoC
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch redirect-iae
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
The following commit(s) were added to refs/heads/redirect-iae by this push:
new 909cf6d cheap fix, PoC
909cf6d is described below
commit 909cf6dfab79ddfdaa6bed7e97b7e99471a66fda
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Oct 15 17:52:35 2019 +0200
cheap fix, PoC
---
.../wagon/shared/http/AbstractHttpClientWagon.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
index 1d25664..22ed166 100755
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
@@ -739,24 +739,35 @@ public abstract class AbstractHttpClientWagon
case HttpStatus.SC_MOVED_PERMANENTLY: // 301
case HttpStatus.SC_MOVED_TEMPORARILY: // 302
case HttpStatus.SC_SEE_OTHER: // 303
+ case HttpStatus.SC_TEMPORARY_REDIRECT: // 307
+ EntityUtils.consume( response.getEntity() );
+ firePutCompleted( resource, source );
put( resource, source, httpEntity, calculateRelocatedUrl( response ) );
return;
case HttpStatus.SC_FORBIDDEN:
+ EntityUtils.consume( response.getEntity() );
fireSessionConnectionRefused();
throw new AuthorizationException( "Access denied to: " + url );
case HttpStatus.SC_NOT_FOUND:
- throw new ResourceDoesNotExistException( "File " + url + " does not exist" );
+ EntityUtils.consume( response.getEntity() );
+ ResourceDoesNotExistException rdnee = new ResourceDoesNotExistException(
+ "File " + url + " does not exist" );
+ fireTransferError( resource, rdnee, TransferEvent.REQUEST_PUT );
+ throw rdnee;
case SC_TOO_MANY_REQUESTS:
+ EntityUtils.consume( response.getEntity() );
+ firePutCompleted( resource, source );
put( backoff( wait, url ), resource, source, httpEntity, url );
- break;
+ return;
//add more entries here
default:
- TransferFailedException e = new TransferFailedException(
+ EntityUtils.consume( response.getEntity() );
+ TransferFailedException tfe = new TransferFailedException(
"Failed to transfer file " + url + " with status code " + statusCode );
- fireTransferError( resource, e, TransferEvent.REQUEST_PUT );
- throw e;
+ fireTransferError( resource, tfe, TransferEvent.REQUEST_PUT );
+ throw tfe;
}
firePutCompleted( resource, source );