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:
adrian.f.cole 2009-06-29 13:52:35 +00:00
parent cc6ff3a805
commit bca4f3f5dd
2 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import org.jclouds.aws.s3.util.S3Utils;
import org.jclouds.aws.s3.xml.S3ParserFactory;
import org.jclouds.http.HttpException;
import org.jclouds.http.HttpFutureCommand;
import org.jclouds.http.HttpHeaders;
import org.jclouds.http.HttpMethod;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.handlers.RedirectionRetryHandler;
@ -82,6 +83,7 @@ public class AWSRedirectionRetryHandler extends RedirectionRetryHandler {
URI endPoint = command.getRequest().getEndPoint();
endPoint = Utils.replaceHostInEndPoint(endPoint, host);
command.getRequest().setEndPoint(endPoint);
command.getRequest().getHeaders().removeAll(HttpHeaders.HOST);
}
return true;
} else {

View File

@ -67,6 +67,7 @@ public class RedirectionRetryHandler implements HttpRetryHandler {
if (hostHeader != null && command.getRedirectCount() < retryCountLimit) {
URI endPoint = parseEndPoint(hostHeader);
command.getRequest().setEndPoint(endPoint);
command.getRequest().getHeaders().removeAll(HttpHeaders.HOST);
return true;
} else {
return false;