This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new def0bc24d47 [fix](s3) do not replace https scheme if specified (#44242)
def0bc24d47 is described below
commit def0bc24d475b742bc52bc073643aaa9514d3d8d
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Nov 19 14:38:30 2024 +0800
[fix](s3) do not replace https scheme if specified (#44242)
### What problem does this PR solve?
Problem Summary:
When creating s3 resource with endpoint, it user already specify
`https://` schema in endpoint url,
we should not replace it with `http://`.
### Release note
[fix](s3) fix bug that s3 resource do not support `https://`
---
.../main/java/org/apache/doris/catalog/S3Resource.java | 2 +-
.../java/org/apache/doris/catalog/S3ResourceTest.java | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java
index e1cde40c4ad..a40e91f47d4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/S3Resource.java
@@ -95,7 +95,7 @@ public class S3Resource extends Resource {
// 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);
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java
index 720e2690c05..4e620d56903 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/S3ResourceTest.java
@@ -222,4 +222,20 @@ public class S3ResourceTest {
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");
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]