Skip to content

Commit a982ae2

Browse files
committed
added path-style support for S3
1 parent dc13ad1 commit a982ae2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/unsuck/unsuck.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,14 @@ inline string readAWSS3(string path, string range) {
388388
else if (const char* env_p = std::getenv("AWS_ENDPOINT_URL_S3")) {
389389
clientConfig.endpointOverride = env_p;
390390
}
391-
auto client = Aws::S3::S3Client(clientConfig);
391+
392+
bool usePathStyle = false; // Default to virtual-style addressing
393+
if (const char* env_p = std::getenv("AWS_USE_PATH_STYLE")) {
394+
std::string env_value(env_p);
395+
usePathStyle = (env_value == "true" || env_value == "1");
396+
}
397+
398+
auto client = Aws::S3::S3Client(clientConfig, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, !usePathStyle);
392399
auto request = Aws::S3::Model::GetObjectRequest();
393400
request.SetBucket(bucket.c_str());
394401
request.SetKey(key.c_str());

0 commit comments

Comments
 (0)