|
@ -6,6 +6,7 @@ import ( |
|
|
"errors" |
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" |
|
|
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" |
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/s3api/s3bucket" |
|
|
"github.com/seaweedfs/seaweedfs/weed/util" |
|
|
"github.com/seaweedfs/seaweedfs/weed/util" |
|
|
"math" |
|
|
"math" |
|
|
"net/http" |
|
|
"net/http" |
|
@ -84,6 +85,14 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request) |
|
|
bucket, _ := s3_constants.GetBucketAndObject(r) |
|
|
bucket, _ := s3_constants.GetBucketAndObject(r) |
|
|
glog.V(3).Infof("PutBucketHandler %s", bucket) |
|
|
glog.V(3).Infof("PutBucketHandler %s", bucket) |
|
|
|
|
|
|
|
|
|
|
|
// validate the bucket name
|
|
|
|
|
|
err := s3bucket.VerifyS3BucketName(bucket) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
glog.Errorf("put invalid bucket name: %v %v", bucket, err) |
|
|
|
|
|
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidBucketName) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// avoid duplicated buckets
|
|
|
// avoid duplicated buckets
|
|
|
errCode := s3err.ErrNone |
|
|
errCode := s3err.ErrNone |
|
|
if err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { |
|
|
if err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { |
|
|