Skip to content

Commit 516f48e

Browse files
tjleingThomas Leinggpanshu
authored
fix(storage): Add support for dualside encryption even if acceleration is off (#3220)
* Add support for dualside encryption even if acceleration is off * Use correct hostname (include region) --------- Co-authored-by: Thomas Leing <[email protected]> Co-authored-by: gpanshu <[email protected]>
1 parent 9fb54ba commit 516f48e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

aws-android-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4764,6 +4764,12 @@ protected <X extends AmazonWebServiceRequest> Request<X> createRequest(String bu
47644764
clientConfiguration);
47654765
}
47664766
}
4767+
else {
4768+
if (clientOptions.isDualstackEnabled()) {
4769+
String hostname = String.format(Constants.S3_DUALSTACK_HOSTNAME, getRegionName());
4770+
endpoint = RuntimeHttpUtils.toUri(hostname, clientConfiguration);
4771+
}
4772+
}
47674773

47684774
request.setHttpMethod(httpMethod);
47694775
resolveRequestEndpoint(request, bucketName, key, endpoint);

aws-android-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class Constants {
3636
public static final String S3_EXTERNAL_1_HOSTNAME = "s3-external-1.amazonaws.com";
3737
/** Service hostname for accessing accelerated S3 buckets */
3838
public static final String S3_ACCELERATE_HOSTNAME = "s3-accelerate.amazonaws.com";
39+
/** Service hostname for accessing dualstack S3 buckets; format argument is the region */
40+
public static final String S3_DUALSTACK_HOSTNAME = "s3.dualstack.%s.amazonaws.com";
3941
/** Service hostname for accessing dualstack accelerated S3 buckets */
4042
public static final String S3_ACCELERATE_DUALSTACK_HOSTNAME = "s3-accelerate.dualstack.amazonaws.com";
4143

0 commit comments

Comments
 (0)