github-actions[bot] commented on code in PR #64853: URL: https://github.com/apache/doris/pull/64853#discussion_r3534101905
########## fe/fe-filesystem/fe-filesystem-http/src/main/java/org/apache/doris/filesystem/http/HttpFileSystemProvider.java: ########## @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.filesystem.http; + +import org.apache.doris.filesystem.FileSystem; +import org.apache.doris.filesystem.properties.FileSystemCapability; +import org.apache.doris.filesystem.spi.FileSystemProvider; + +import java.util.EnumSet; +import java.util.Map; +import java.util.Set; + +/** + * SPI provider for HTTP storage (http://, https://, hf:// URIs). + * + * <p>HTTP has no FileSystem implementation: the http() TVF reads via HttpUtils on FE and + * TFileType.FILE_HTTP on BE. This provider only binds and validates properties; {@link #create} + * throws. Use {@link #capabilities(HttpFileSystemProperties)} (READ) to gate operations + * instead of calling create(). + */ +public class HttpFileSystemProvider implements FileSystemProvider<HttpFileSystemProperties> { + + @Override + public boolean supports(Map<String, String> properties) { + if ("HTTP".equalsIgnoreCase(properties.get("_STORAGE_TYPE_"))) { + return true; + } + String uri = properties.getOrDefault("uri", ""); + return uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("hf://"); Review Comment: This provider should not claim every `http://` or `https://` `uri` without checking that the storage is actually HTTP. Filesystem plugin directories are loaded in sorted directory-name order, so `http` is registered before `s3`, and `FileSystemPluginManager.createFileSystem()` stops at the first provider whose `supports()` returns true. A valid raw SPI map can still carry an HTTPS-style S3 URI together with explicit S3 markers/credentials (`_STORAGE_TYPE_=S3`, endpoint/region); S3 already accepts those URLs via `S3PropertyUtils`, but this provider will match first and then `create(Map)` throws because HTTP has no FileSystem. Please make the match require an HTTP marker such as `_STORAGE_TYPE_=HTTP`/`fs.http.support=true`, or at least reject maps that explicitly belong to another storage provider, and add a provider-selection test for an HTTPS S3 URI. -- 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]
