mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-03 02:58:26 +00:00
curl: use pathrequeststyle option when constructing Host endpoint
Buckets with mixed-case names can't be accessed with the virtual-hosted style API due to DNS limitations. S3FS has an option for pathrequeststyle which is used for the URL, but it was not applied when building the endpoint passed through the Host header. Fix this, and relax the validation on bucket names when using this style. See: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
00f8e1d0ba
commit
92fcee824b
@ -121,8 +121,11 @@ static string url_to_host(const std::string &url)
|
|||||||
|
|
||||||
static string get_bucket_host()
|
static string get_bucket_host()
|
||||||
{
|
{
|
||||||
|
if(!pathrequeststyle){
|
||||||
return bucket + "." + url_to_host(host);
|
return bucket + "." + url_to_host(host);
|
||||||
}
|
}
|
||||||
|
return url_to_host(host) + "/" + bucket;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 // noused
|
#if 0 // noused
|
||||||
static string tolower_header_name(const char* head)
|
static string tolower_header_name(const char* head)
|
||||||
|
@ -4050,9 +4050,9 @@ int main(int argc, char* argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bucket names cannot contain upper case characters
|
// bucket names cannot contain upper case characters in virtual-hosted style
|
||||||
if(lower(bucket) != bucket){
|
if((!pathrequeststyle) && (lower(bucket) != bucket)){
|
||||||
fprintf(stderr, "%s: BUCKET %s, upper case characters are not supported\n",
|
fprintf(stderr, "%s: BUCKET %s, name not compatible with virtual-hosted style\n",
|
||||||
program_name.c_str(), bucket.c_str());
|
program_name.c_str(), bucket.c_str());
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user