16745: Handle GetBucketLocation API.
authorTom Clegg <tom@curii.com>
Tue, 2 Mar 2021 16:12:11 +0000 (11:12 -0500)
committerTom Clegg <tom@curii.com>
Tue, 2 Mar 2021 16:12:11 +0000 (11:12 -0500)
Previously misinterpreted as ListObjects with no delimiter, which is
very slow.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keep-web/s3.go

index d500f1e65a37e13739529f80e10a2e52a6dcf181..9479b58860bd99fb5ac57066c691158ad85a3fa5 100644 (file)
@@ -288,6 +288,11 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
                        w.Header().Set("Content-Type", "application/xml")
                        io.WriteString(w, xml.Header)
                        fmt.Fprintln(w, `<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>`)
+               } else if _, ok = r.URL.Query()["location"]; ok {
+                       // GetBucketLocation
+                       w.Header().Set("Content-Type", "application/xml")
+                       io.WriteString(w, xml.Header)
+                       fmt.Fprintln(w, `<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">`+h.Config.cluster.ClusterID+`</LocationConstraint>`)
                } else {
                        // ListObjects
                        h.s3list(bucketName, w, r, fs)