Gabriel39 commented on code in PR #71089:
URL: https://github.com/apache/doris/pull/71089#discussion_r4748860078
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java:
##########
@@ -453,17 +463,24 @@ static HostAndPort parseEndpoint(String value) {
}
return HostAndPort.fromParts(uri.getHost(), port);
}
+ if (defaultPort >= 0) {
+ // Web clients parse userinfo and suffixes as URL components,
then normalize the host
+ // through OkHttp (including percent escapes). Probe the same
socket destination.
+ URL url = new URL("https://" + value);
+ HttpUrl target = HttpUrl.get(url);
+ return HostAndPort.fromParts(target.host(), url.getPort() >= 0
? url.getPort() : defaultPort);
Review Comment:
Fixed in a2bd1c2fe7. The nullable OkHttp URL result is now guarded before
reading the host. Malformed hosts, empty userinfo and out-of-range ports
preserve the no-destination/null contract on CREATE and ALTER for both DLF
aliases and providers. The unreachable defaultPort fallback logic is simplified
as suggested. All 88 catalog-gate tests pass, including the four cases that
reproduced the NPE on the baseline.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java:
##########
@@ -439,11 +445,15 @@ private void checkEndpointsAgainstSsrf(Map<String,
String> candidate, Map<String
* probe); {@link HostAndPort} handles IPv6 literals in brackets natively.
*/
static HostAndPort parseEndpoint(String value) {
+ return parseEndpoint(value, -1);
+ }
+
+ private static HostAndPort parseEndpoint(String value, int defaultPort) {
if (value == null || value.isEmpty()) {
return null;
}
try {
- if (value.contains("://")) {
+ if (value.matches("[A-Za-z][A-Za-z0-9+.-]*://.*")) {
// Match the HMS client's URI semantics: query, fragment and
userinfo do not name
// the socket destination. HostAndPort.fromParts also strips
IPv6 brackets.
URI uri = new URI(value);
Review Comment:
Fixed in a2bd1c2fe7. Explicit HTTP/HTTPS endpoints now use HttpUrl.parse so
the checker sees decoded hostnames and the same default/explicit ports as the
web client. Added CREATE/ALTER coverage for the encoded loopback host at HTTP
80, HTTPS 443 and HTTPS 8443, including unchanged stored properties after
rejected ALTER. The three new cases failed on the baseline and pass with the
fix.
##########
fe/fe-connector/fe-connector-metastore-hms/src/main/java/org/apache/doris/connector/metastore/hms/DefaultHmsMetaStoreProperties.java:
##########
@@ -42,6 +48,25 @@ public static DefaultHmsMetaStoreProperties of(Map<String,
String> raw, Map<Stri
@Override
public void validate() {
- validateConnection();
+ if (dlf != null) {
+ dlf.validate();
Review Comment:
Fixed in a2bd1c2fe7. The existing HMS authentication predicates are
extracted and reused for all five HMS-using DLF proxy modes. This checks
missing/partial Kerberos credentials and simple/credential conflicts without
imposing a new inline URI requirement on catalogs using hive-site.xml. DLF_ONLY
and canonical proxy-mode precedence remain covered. Verification includes 17
DLF HMS-holder tests, native HMS controls and CREATE/ALTER rejection for all
five modes; the full selected run has 276 classes / 3709 tests with zero
failures/errors (11 existing disabled tests).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]