Corrected request building/signing to specify ETag values in 'Content-MD5' HTTP header instead of the 'ETag' header, which is only used in responses

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1619 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
jamurty 2009-07-13 19:08:13 +00:00
parent 03631f84d1
commit d8557f6d89
3 changed files with 6 additions and 5 deletions

View File

@ -62,9 +62,10 @@ public class S3ObjectBinder implements EntityBinder {
object.getMetadata().getContentEncoding()); object.getMetadata().getContentEncoding());
} }
if (object.getMetadata().getETag() != null) if (object.getMetadata().getETag() != null) {
request.getHeaders().put(HttpHeaders.ETAG, request.getHeaders().put("Content-MD5",
HttpUtils.toBase64String(object.getMetadata().getETag())); HttpUtils.toBase64String(object.getMetadata().getETag()));
}
request.getHeaders().putAll(object.getMetadata().getUserMetadata()); request.getHeaders().putAll(object.getMetadata().getUserMetadata());
} }

View File

@ -53,8 +53,8 @@ import com.google.inject.name.Named;
*/ */
@Singleton @Singleton
public class RequestAuthorizeSignature implements HttpRequestFilter { public class RequestAuthorizeSignature implements HttpRequestFilter {
private final String[] firstHeadersToSign = new String[] { HttpHeaders.ETAG, private final String[] firstHeadersToSign = new String[] {
HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE }; "Content-MD5", HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE };
private final String accessKey; private final String accessKey;
private final String secretKey; private final String secretKey;

View File

@ -68,7 +68,7 @@ public class Utils {
String lk = hashKey.toLowerCase(); String lk = hashKey.toLowerCase();
// Ignore any headers that are not particularly interesting. // Ignore any headers that are not particularly interesting.
if (lk.equals("content-type") || lk.equals("content-eTag") || lk.equals("date") || if (lk.equals("content-type") || lk.equals("content-md5") || lk.equals("date") ||
lk.startsWith(AMAZON_HEADER_PREFIX)) lk.startsWith(AMAZON_HEADER_PREFIX))
{ {
List s = (List)headers.get(hashKey); List s = (List)headers.get(hashKey);