Interpret chunked encoding with anonymous access

Also check authentication type correctly in the constructor to handle
configurations with anonymous access but set identity and credential.
References #145.
pull/194/head^2
Andrew Gaul 2017-03-10 19:42:15 -08:00
rodzic 842eaaf719
commit 8224f6fe6e
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -241,7 +241,7 @@ public class S3ProxyHandler {
final String credential, Optional<String> virtualHost,
long v4MaxNonChunkedRequestSize, boolean ignoreUnknownHeaders,
boolean ignoreUnknownParameters, boolean corsAllowAll) {
if (identity != null) {
if (authenticationType != AuthenticationType.NONE) {
anonymousIdentity = false;
blobStoreLocator = new BlobStoreLocator() {
@Override
@ -389,6 +389,10 @@ public class S3ProxyHandler {
path.length > 2 ? path[2] : null);
if (anonymousIdentity) {
blobStore = provider.getValue();
String contentSha256 = request.getHeader("x-amz-content-sha256");
if ("STREAMING-AWS4-HMAC-SHA256-PAYLOAD".equals(contentSha256)) {
is = new ChunkedInputStream(is);
}
} else if (requestIdentity == null) {
throw new S3Exception(S3ErrorCode.ACCESS_DENIED);
} else {