Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void setProperties(Map<String, String> properties) throws DdlException

// the endpoint for ping need add uri scheme.
String pingEndpoint = properties.get(S3Properties.ENDPOINT);
if (!pingEndpoint.startsWith("http://")) {
if (!pingEndpoint.startsWith("http://") && !pingEndpoint.startsWith("https://")) {
pingEndpoint = "http://" + properties.get(S3Properties.ENDPOINT);
properties.put(S3Properties.ENDPOINT, pingEndpoint);
properties.put(S3Properties.Env.ENDPOINT, pingEndpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,20 @@ public void testModifyProperties() throws Exception {
modify.put("s3.access_key", "aaa");
s3Resource.modifyProperties(modify);
}

@Test
public void testHttpScheme() throws DdlException {
// if https:// is set, it should be replaced with http://
Map<String, String> properties = new HashMap<>();
properties.put("AWS_ENDPOINT", "https://aaa");
properties.put("AWS_REGION", "bbb");
properties.put("AWS_ROOT_PATH", "/path/to/root");
properties.put("AWS_ACCESS_KEY", "xxx");
properties.put("AWS_SECRET_KEY", "yyy");
properties.put("AWS_BUCKET", "test-bucket");
properties.put("s3_validity_check", "false");
S3Resource s3Resource = new S3Resource("s3_2");
s3Resource.setProperties(properties);
Assert.assertEquals(s3Resource.getProperty(S3Properties.ENDPOINT), "https://aaa");
}
}