From 9b59d099d18bb2f1894f81b0f52a9c853aa5e599 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 21 Nov 2017 11:36:11 -0800 Subject: [PATCH] JCLOUDS-1358: Handle 0-byte input with v4 signature Previously this failed due to use of mark and reset on the InputStream. --- .../jclouds/s3/filters/Aws4SignerForAuthorizationHeader.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerForAuthorizationHeader.java b/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerForAuthorizationHeader.java index 4bb160a1f5..f481fc06d7 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerForAuthorizationHeader.java +++ b/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerForAuthorizationHeader.java @@ -169,8 +169,7 @@ public class Aws4SignerForAuthorizationHeader extends Aws4SignerBase { protected String getPayloadHash(HttpRequest request) { Payload payload = request.getPayload(); - if (payload == null) { - // when payload is null. + if (payload == null || "0".equals(getContentLength(request))) { return getEmptyPayloadContentHash(); } return calculatePayloadContentHash(payload);