From 1a51604b26e7cd1b3f3e7d30176b251501070e07 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 29 Nov 2018 17:55:55 -0800 Subject: [PATCH] s3api: Look for more indications of aws-chunked uploads Change-Id: I7dda8a25c9e13b0d81293f0a966c34713c93f6ad Related-Bug: 1810026 --- swift/common/middleware/s3api/s3request.py | 5 ++++- test/unit/common/middleware/s3api/test_s3api.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/swift/common/middleware/s3api/s3request.py b/swift/common/middleware/s3api/s3request.py index 03894a09e0..77a6fccfd0 100644 --- a/swift/common/middleware/s3api/s3request.py +++ b/swift/common/middleware/s3api/s3request.py @@ -749,7 +749,10 @@ class S3Request(swob.Request): # https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html # describes some of what would be required to support this - if 'aws-chunked' in self.headers.get('content-encoding', ''): + if any(['aws-chunked' in self.headers.get('content-encoding', ''), + 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD' == self.headers.get( + 'x-amz-content-sha256', ''), + 'x-amz-decoded-content-length' in self.headers]): raise S3NotImplemented('Transfering payloads in multiple chunks ' 'using aws-chunked is not supported.') diff --git a/test/unit/common/middleware/s3api/test_s3api.py b/test/unit/common/middleware/s3api/test_s3api.py index 332fd0dce9..4318764b60 100644 --- a/test/unit/common/middleware/s3api/test_s3api.py +++ b/test/unit/common/middleware/s3api/test_s3api.py @@ -574,6 +574,11 @@ class TestS3ApiMiddleware(S3ApiTestCase): # > That is, you can specify your custom content-encoding when using # > Signature Version 4 streaming API. self._test_unsupported_header('Content-Encoding', 'aws-chunked,gzip') + # Some clients skip the content-encoding, + # such as minio-go and aws-sdk-java + self._test_unsupported_header('x-amz-content-sha256', + 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD') + self._test_unsupported_header('x-amz-decoded-content-length') def test_object_tagging(self): self._test_unsupported_header('x-amz-tagging')