changeset 74:a25b4140e7e4

AWS: added the content MD5 in the request when writing
author Alain Mazy <am@osimis.io>
date Tue, 15 Feb 2022 06:01:47 +0100
parents 4a747c76ae3b
children ac596874d997
files Aws/AwsS3StoragePlugin.cpp NEWS
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Aws/AwsS3StoragePlugin.cpp	Mon Sep 06 16:54:42 2021 +0200
+++ b/Aws/AwsS3StoragePlugin.cpp	Tue Feb 15 06:01:47 2022 +0100
@@ -26,6 +26,7 @@
 #include <aws/s3/model/DeleteObjectRequest.h>
 #include <aws/core/auth/AWSCredentialsProvider.h>
 #include <aws/core/utils/memory/stl/AWSStringStream.h>
+#include <aws/core/utils/HashingUtils.h>
 #include <aws/crt/Api.h>
 
 #include <boost/lexical_cast.hpp>
@@ -88,6 +89,7 @@
     stream->seekg(0);
 
     putObjectRequest.SetBody(stream);
+    putObjectRequest.SetContentMD5(Aws::Utils::HashingUtils::Base64Encode(Aws::Utils::HashingUtils::CalculateMD5(*stream)));
 
     auto result = client_.PutObject(putObjectRequest);
 
--- a/NEWS	Mon Sep 06 16:54:42 2021 +0200
+++ b/NEWS	Tue Feb 15 06:01:47 2022 +0100
@@ -1,3 +1,9 @@
+Pending changes in the mainline
+===============================
+
+* AWS: added the content MD5 in the request when writing.  This adds integrity check and enables some feature on AWS side
+  like https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html
+
 2021-09-06 - v 1.3.3
 ====================