|
|
@ -136,3 +136,31 @@ func (s3a *S3ApiServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Reque |
|
|
|
|
|
|
|
writeResponse(w, http.StatusNoContent, nil, mimeNone) |
|
|
|
} |
|
|
|
|
|
|
|
func (s3a *S3ApiServer) HeadBucketHandler(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
vars := mux.Vars(r) |
|
|
|
bucket := vars["bucket"] |
|
|
|
|
|
|
|
err := s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
|
|
|
|
request := &filer_pb.LookupDirectoryEntryRequest{ |
|
|
|
Directory: s3a.option.BucketsPath, |
|
|
|
Name: bucket, |
|
|
|
} |
|
|
|
|
|
|
|
glog.V(1).Infof("lookup bucket: %v", request) |
|
|
|
if _, err := client.LookupDirectoryEntry(context.Background(), request); err != nil { |
|
|
|
return fmt.Errorf("lookup bucket %s/%s: %v", s3a.option.BucketsPath, bucket, err) |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
}) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
writeErrorResponse(w, ErrNoSuchBucket, r.URL) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
writeSuccessResponseEmpty(w) |
|
|
|
} |