Skip to content

Commit

Permalink
Do not send canned ACL header when empty string
Browse files Browse the repository at this point in the history
Some providers such as StorageGRID do not support canned ACLs.
Setting to empty allows callers to omit the header.  References s3fs-fuse#125.
  • Loading branch information
gaul committed May 7, 2017
1 parent df0ff3a commit 7b30d5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()){
Expand Down Expand Up @@ -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()){
Expand Down Expand Up @@ -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()){
Expand Down
5 changes: 3 additions & 2 deletions src/s3fs_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7b30d5d

Please sign in to comment.