From deb11c2e32fdbe57435a19935dfb516cf3a0467c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 28 Jan 2015 15:36:27 -0800 Subject: [PATCH] Remove BucketLocation() function, minio does not implement such a resource --- pkg/minio/client.go | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/pkg/minio/client.go b/pkg/minio/client.go index 0cdefe21..32c522be 100644 --- a/pkg/minio/client.go +++ b/pkg/minio/client.go @@ -79,7 +79,7 @@ func newReq(url_ string) *http.Request { if err != nil { panic(fmt.Sprintf("minio client; invalid URL: %v", err)) } - req.Header.Set("User-Agent", "minio") + req.Header.Set("User-Agent", "Minio") return req } @@ -190,24 +190,6 @@ type listBucketResults struct { Marker string } -// BucketLocation returns the Minio hostname to be used with the given bucket. -func (c *Client) BucketLocation(bucket string, hostname string) (location string, err error) { - url_ := fmt.Sprintf("http://%s/%s/?location", hostname, url.QueryEscape(bucket)) - req := newReq(url_) - res, err := c.transport().RoundTrip(req) - if err != nil { - return - } - var xres xmlLocationConstraint - if err := xml.NewDecoder(res.Body).Decode(&xres); err != nil { - return "", err - } - if xres.Location == "" { - return "localhost", nil - } - return "minio-" + xres.Location + "." + hostname, nil -} - // GetBucket (List Objects) returns 0 to maxKeys (inclusive) items from the // provided bucket. Keys before startAt will be skipped. (This is the MINIO // 'marker' value). If the length of the returned items is equal to @@ -377,7 +359,7 @@ func (e *Error) parseXML() { } if xe.Code == "SignatureDoesNotMatch" { want, _ := hex.DecodeString(strings.Replace(xe.StringToSignBytes, " ", "", -1)) - log.Printf("MINIO SignatureDoesNotMatch. StringToSign should be %d bytes: %q (%x)", len(want), want, want) + log.Printf("Minio SignatureDoesNotMatch. StringToSign should be %d bytes: %q (%x)", len(want), want, want) } } @@ -392,9 +374,3 @@ type xmlError struct { Endpoint string StringToSignBytes string } - -// xmlLocationConstraint is the LocationConstraint returned from BucketLocation. -type xmlLocationConstraint struct { - XMLName xml.Name `xml:"LocationConstraint"` - Location string `xml:",chardata"` -}