s3: change s3 tables to use RESTful API (#8169)
* s3: refactor s3 tables to use RESTful API * test/s3tables: guard empty namespaces * s3api: document tag parsing and validate get-table * s3api: limit S3Tables REST body size * Update weed/s3api/s3api_tables.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/s3api/s3tables/handler.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * s3api: accept encoded table bucket ARNs * s3api: validate namespaces and close body * s3api: match encoded table bucket ARNs * s3api: scope table bucket ARN routes * s3api: dedupe table bucket request builders * test/s3tables: allow list tables without namespace * s3api: validate table params and tag ARN * s3api: tighten tag handling and get-table params * s3api: loosen tag ARN route matching * Fix S3 Tables REST routing and tests * Adjust S3 Tables request parsing * Gate S3 Tables target routing * Avoid double decoding namespaces --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -74,17 +74,16 @@ type FilerClient interface {
|
||||
|
||||
// HandleRequest is the main entry point for S3 Tables API requests
|
||||
func (h *S3TablesHandler) HandleRequest(w http.ResponseWriter, r *http.Request, filerClient FilerClient) {
|
||||
// S3 Tables API uses x-amz-target header to specify the operation
|
||||
target := r.Header.Get("X-Amz-Target")
|
||||
if target == "" {
|
||||
// Try to get from query parameter for CLI compatibility
|
||||
target = r.URL.Query().Get("Action")
|
||||
operation := r.Header.Get("X-Amz-Target")
|
||||
if operation != "" {
|
||||
if idx := strings.LastIndex(operation, "."); idx != -1 {
|
||||
operation = operation[idx+1:]
|
||||
}
|
||||
}
|
||||
|
||||
// Extract operation name (e.g., "S3Tables.CreateTableBucket" -> "CreateTableBucket")
|
||||
operation := target
|
||||
if idx := strings.LastIndex(target, "."); idx != -1 {
|
||||
operation = target[idx+1:]
|
||||
if operation == "" {
|
||||
glog.V(1).Infof("S3Tables: missing X-Amz-Target header")
|
||||
h.writeError(w, http.StatusBadRequest, ErrCodeInvalidRequest, "Missing X-Amz-Target header")
|
||||
return
|
||||
}
|
||||
|
||||
glog.V(3).Infof("S3Tables: handling operation %s", operation)
|
||||
|
||||
Reference in New Issue
Block a user