mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-24 14:28:24 +00:00
Merge pull request #1199 from ahuarte47/master_requester-pays
Adds requester_pays option to enable requests involving Requester Pays buckets
This commit is contained in:
commit
a9d527d517
@ -392,6 +392,7 @@ off_t S3fsCurl::multipart_size = MULTIPART_SIZE; // default
|
|||||||
bool S3fsCurl::is_sigv4 = true; // default
|
bool S3fsCurl::is_sigv4 = true; // default
|
||||||
bool S3fsCurl::is_ua = true; // default
|
bool S3fsCurl::is_ua = true; // default
|
||||||
bool S3fsCurl::is_use_session_token = false; // default
|
bool S3fsCurl::is_use_session_token = false; // default
|
||||||
|
bool S3fsCurl::requester_pays = false; // default
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Class methods for S3fsCurl
|
// Class methods for S3fsCurl
|
||||||
@ -2755,6 +2756,10 @@ void S3fsCurl::insertV4Headers()
|
|||||||
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-content-sha256", contentSHA256.c_str());
|
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-content-sha256", contentSHA256.c_str());
|
||||||
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-date", date8601.c_str());
|
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-date", date8601.c_str());
|
||||||
|
|
||||||
|
if (S3fsCurl::IsRequesterPays()) {
|
||||||
|
requestHeaders = curl_slist_sort_insert(requestHeaders, "x-amz-request-payer", "requester");
|
||||||
|
}
|
||||||
|
|
||||||
if(!S3fsCurl::IsPublicBucket()){
|
if(!S3fsCurl::IsPublicBucket()){
|
||||||
string Signature = CalcSignature(op, realpath, query_string + (type == REQTYPE_PREMULTIPOST || type == REQTYPE_MULTILIST ? "=" : ""), strdate, contentSHA256, date8601);
|
string Signature = CalcSignature(op, realpath, query_string + (type == REQTYPE_PREMULTIPOST || type == REQTYPE_MULTILIST ? "=" : ""), strdate, contentSHA256, date8601);
|
||||||
string auth = "AWS4-HMAC-SHA256 Credential=" + AWSAccessKeyId + "/" + strdate + "/" + endpoint +
|
string auth = "AWS4-HMAC-SHA256 Credential=" + AWSAccessKeyId + "/" + strdate + "/" + endpoint +
|
||||||
|
@ -301,6 +301,7 @@ class S3fsCurl
|
|||||||
static off_t multipart_size;
|
static off_t multipart_size;
|
||||||
static bool is_sigv4;
|
static bool is_sigv4;
|
||||||
static bool is_ua; // User-Agent
|
static bool is_ua; // User-Agent
|
||||||
|
static bool requester_pays;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
CURL* hCurl;
|
CURL* hCurl;
|
||||||
@ -477,6 +478,8 @@ class S3fsCurl
|
|||||||
static bool SetUserAgentFlag(bool isset) { bool bresult = S3fsCurl::is_ua; S3fsCurl::is_ua = isset; return bresult; }
|
static bool SetUserAgentFlag(bool isset) { bool bresult = S3fsCurl::is_ua; S3fsCurl::is_ua = isset; return bresult; }
|
||||||
static bool IsUserAgentFlag(void) { return S3fsCurl::is_ua; }
|
static bool IsUserAgentFlag(void) { return S3fsCurl::is_ua; }
|
||||||
static void InitUserAgent(void);
|
static void InitUserAgent(void);
|
||||||
|
static bool SetRequesterPays(bool flag) { bool old_flag = S3fsCurl::requester_pays; S3fsCurl::requester_pays = flag; return old_flag; }
|
||||||
|
static bool IsRequesterPays(void) { return S3fsCurl::requester_pays; }
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
||||||
|
@ -5062,6 +5062,10 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
|||||||
use_wtf8 = true;
|
use_wtf8 = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(0 == strcmp(arg, "requester_pays")){
|
||||||
|
S3fsCurl::SetRequesterPays(true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// [NOTE]
|
// [NOTE]
|
||||||
// following option will be discarding, because these are not for fuse.
|
// following option will be discarding, because these are not for fuse.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user