JCLOUDS-1358: Handle 0-byte input with v4 signature

Previously this failed due to use of mark and reset on the
InputStream.
This commit is contained in:
Andrew Gaul 2017-11-21 11:36:11 -08:00
parent d29b79674d
commit 9b59d099d1
1 changed files with 1 additions and 2 deletions

View File

@ -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);