From 7b30d5d15b6999b8b4fb3f221004c8a49c185c4e Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 22 Apr 2017 16:15:02 -0700 Subject: [PATCH] Do not send canned ACL header when empty string Some providers such as StorageGRID do not support canned ACLs. Setting to empty allows callers to omit the header. References #125. --- src/curl.cpp | 12 +++++++++--- src/s3fs_util.cpp | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index d062af907e..3421f75062 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2611,7 +2611,9 @@ int S3fsCurl::PutHeadRequest(const char* tpath, headers_t& meta, bool is_copy) } // "x-amz-acl", storage class, sse - requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + if(!S3fsCurl::default_acl.empty()){ + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + } if(REDUCED_REDUNDANCY == GetStorageClass()){ requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "REDUCED_REDUNDANCY"); } else if(STANDARD_IA == GetStorageClass()){ @@ -2731,7 +2733,9 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd) } } // "x-amz-acl", storage class, sse - requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + if(!S3fsCurl::default_acl.empty()){ + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + } if(REDUCED_REDUNDANCY == GetStorageClass()){ requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "REDUCED_REDUNDANCY"); } else if(STANDARD_IA == GetStorageClass()){ @@ -3045,7 +3049,9 @@ int S3fsCurl::PreMultipartPostRequest(const char* tpath, headers_t& meta, string } } // "x-amz-acl", storage class, sse - requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + if(!S3fsCurl::default_acl.empty()){ + requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-acl", S3fsCurl::default_acl.c_str()); + } if(REDUCED_REDUNDANCY == GetStorageClass()){ requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-storage-class", "REDUCED_REDUNDANCY"); } else if(STANDARD_IA == GetStorageClass()){ diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index 0ce2b7ffaf..776250da81 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -950,8 +950,9 @@ void show_help (void) " must specify this option after -o option for bucket name.\n" "\n" " default_acl (default=\"private\")\n" - " - the default canned acl to apply to all written s3 objects\n" - " see http://aws.amazon.com/documentation/s3/ for the \n" + " - the default canned acl to apply to all written s3 objects,\n" + " e.g., private, public-read. empty string means do not send\n" + " header. see http://aws.amazon.com/documentation/s3/ for the\n" " full list of canned acls\n" "\n" " retries (default=\"2\")\n"