|
|
@ -673,13 +673,18 @@ func (f bucketForwardingHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques |
|
|
|
bucket, _ = urlPath2BucketObjectName(r.URL.Path) |
|
|
|
bucket, _ = urlPath2BucketObjectName(r.URL.Path) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if bucket != "" { |
|
|
|
if bucket == "" { |
|
|
|
|
|
|
|
f.handler.ServeHTTP(w, r) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
sr, err := globalDNSConfig.Get(bucket) |
|
|
|
sr, err := globalDNSConfig.Get(bucket) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if err == dns.ErrNoEntriesFound { |
|
|
|
if err == dns.ErrNoEntriesFound { |
|
|
|
writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrNoSuchBucket), r.URL, guessIsBrowserReq(r)) |
|
|
|
writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrNoSuchBucket), |
|
|
|
|
|
|
|
r.URL, guessIsBrowserReq(r)) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
writeErrorResponse(context.Background(), w, toAPIError(context.Background(), err), r.URL, guessIsBrowserReq(r)) |
|
|
|
writeErrorResponse(context.Background(), w, toAPIError(context.Background(), err), |
|
|
|
|
|
|
|
r.URL, guessIsBrowserReq(r)) |
|
|
|
} |
|
|
|
} |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -692,8 +697,6 @@ func (f bucketForwardingHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques |
|
|
|
f.fwd.ServeHTTP(w, r) |
|
|
|
f.fwd.ServeHTTP(w, r) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
f.handler.ServeHTTP(w, r) |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -715,10 +718,13 @@ func (f bucketForwardingHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques |
|
|
|
// CopyObject requests should be handled at current endpoint as path style
|
|
|
|
// CopyObject requests should be handled at current endpoint as path style
|
|
|
|
// requests have target bucket and object in URI and source details are in
|
|
|
|
// requests have target bucket and object in URI and source details are in
|
|
|
|
// header fields
|
|
|
|
// header fields
|
|
|
|
if r.Method == http.MethodPut && r.Header.Get("X-Amz-Copy-Source") != "" { |
|
|
|
if r.Method == http.MethodPut && r.Header.Get(xhttp.AmzCopySource) != "" { |
|
|
|
|
|
|
|
bucket, object = urlPath2BucketObjectName(r.Header.Get(xhttp.AmzCopySource)) |
|
|
|
|
|
|
|
if bucket == "" || object == "" { |
|
|
|
f.handler.ServeHTTP(w, r) |
|
|
|
f.handler.ServeHTTP(w, r) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
sr, err := globalDNSConfig.Get(bucket) |
|
|
|
sr, err := globalDNSConfig.Get(bucket) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if err == dns.ErrNoEntriesFound { |
|
|
|
if err == dns.ErrNoEntriesFound { |
|
|
|