mirror of https://github.com/apache/jclouds.git
Issue 69: remove host header when we redirect
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1492 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
cc6ff3a805
commit
bca4f3f5dd
|
@ -31,6 +31,7 @@ import org.jclouds.aws.s3.util.S3Utils;
|
||||||
import org.jclouds.aws.s3.xml.S3ParserFactory;
|
import org.jclouds.aws.s3.xml.S3ParserFactory;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpFutureCommand;
|
import org.jclouds.http.HttpFutureCommand;
|
||||||
|
import org.jclouds.http.HttpHeaders;
|
||||||
import org.jclouds.http.HttpMethod;
|
import org.jclouds.http.HttpMethod;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
||||||
|
@ -82,6 +83,7 @@ public class AWSRedirectionRetryHandler extends RedirectionRetryHandler {
|
||||||
URI endPoint = command.getRequest().getEndPoint();
|
URI endPoint = command.getRequest().getEndPoint();
|
||||||
endPoint = Utils.replaceHostInEndPoint(endPoint, host);
|
endPoint = Utils.replaceHostInEndPoint(endPoint, host);
|
||||||
command.getRequest().setEndPoint(endPoint);
|
command.getRequest().setEndPoint(endPoint);
|
||||||
|
command.getRequest().getHeaders().removeAll(HttpHeaders.HOST);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class RedirectionRetryHandler implements HttpRetryHandler {
|
||||||
if (hostHeader != null && command.getRedirectCount() < retryCountLimit) {
|
if (hostHeader != null && command.getRedirectCount() < retryCountLimit) {
|
||||||
URI endPoint = parseEndPoint(hostHeader);
|
URI endPoint = parseEndPoint(hostHeader);
|
||||||
command.getRequest().setEndPoint(endPoint);
|
command.getRequest().setEndPoint(endPoint);
|
||||||
|
command.getRequest().getHeaders().removeAll(HttpHeaders.HOST);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue