avoid util package depends on security package
This commit is contained in:
@@ -36,7 +36,7 @@ func main() {
|
|||||||
log.Fatalf("upload: %v", err)
|
log.Fatalf("upload: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
util.Delete(targetUrl, assignResult.Auth)
|
util.Delete(targetUrl, string(assignResult.Auth))
|
||||||
|
|
||||||
util.Get(fmt.Sprintf("http://%s/vol/vacuum", *master))
|
util.Get(fmt.Sprintf("http://%s/vol/vacuum", *master))
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stat) {
|
|||||||
if isSecure {
|
if isSecure {
|
||||||
jwtAuthorization = operation.LookupJwt(masterClient.GetMaster(), df.fp.Fid)
|
jwtAuthorization = operation.LookupJwt(masterClient.GetMaster(), df.fp.Fid)
|
||||||
}
|
}
|
||||||
if e := util.Delete(fmt.Sprintf("http://%s/%s", df.fp.Server, df.fp.Fid), jwtAuthorization); e == nil {
|
if e := util.Delete(fmt.Sprintf("http://%s/%s", df.fp.Server, df.fp.Fid), string(jwtAuthorization)); e == nil {
|
||||||
s.completed++
|
s.completed++
|
||||||
} else {
|
} else {
|
||||||
s.failed++
|
s.failed++
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ func ReplicatedDelete(masterNode string, store *storage.Store,
|
|||||||
if needToReplicate { //send to other replica locations
|
if needToReplicate { //send to other replica locations
|
||||||
if r.FormValue("type") != "replicate" {
|
if r.FormValue("type") != "replicate" {
|
||||||
if err = distributedOperation(masterNode, store, volumeId, func(location operation.Location) error {
|
if err = distributedOperation(masterNode, store, volumeId, func(location operation.Location) error {
|
||||||
return util.Delete("http://"+location.Url+r.URL.Path+"?type=replicate", jwt)
|
return util.Delete("http://"+location.Url+r.URL.Path+"?type=replicate", string(jwt))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
ret = 0
|
ret = 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/security"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -97,7 +95,7 @@ func Head(url string) (http.Header, error) {
|
|||||||
return r.Header, nil
|
return r.Header, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Delete(url string, jwt security.EncodedJwt) error {
|
func Delete(url string, jwt string) error {
|
||||||
req, err := http.NewRequest("DELETE", url, nil)
|
req, err := http.NewRequest("DELETE", url, nil)
|
||||||
if jwt != "" {
|
if jwt != "" {
|
||||||
req.Header.Set("Authorization", "BEARER "+string(jwt))
|
req.Header.Set("Authorization", "BEARER "+string(jwt))
|
||||||
|
|||||||
Reference in New Issue
Block a user