diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-02-10 13:43:53 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-02-10 13:43:53 -0800 |
| commit | 33b3bd467cfa222a910d0298bf3e2a77428ce843 (patch) | |
| tree | 9a4e1db86dd5f26ea831c4af2be1d9cac7e75990 /weed/operation/assign_file_id.go | |
| parent | 58f126fd27bb2f366f76f42223b93ba3b31a0bd8 (diff) | |
| download | seaweedfs-33b3bd467cfa222a910d0298bf3e2a77428ce843.tar.xz seaweedfs-33b3bd467cfa222a910d0298bf3e2a77428ce843.zip | |
Revert "HEAD operation changes to fasthttp"
This reverts commit 58f126fd27bb2f366f76f42223b93ba3b31a0bd8.
Diffstat (limited to 'weed/operation/assign_file_id.go')
| -rw-r--r-- | weed/operation/assign_file_id.go | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go index 3f3bb13e0..b67d8b708 100644 --- a/weed/operation/assign_file_id.go +++ b/weed/operation/assign_file_id.go @@ -1,17 +1,13 @@ package operation import ( - "bytes" "context" "fmt" - - "github.com/valyala/fasthttp" - "google.golang.org/grpc" - - "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/util" + "google.golang.org/grpc" + "strings" ) type VolumeAssignRequest struct { @@ -93,16 +89,12 @@ func Assign(server string, grpcDialOption grpc.DialOption, primaryRequest *Volum func LookupJwt(master string, fileId string) security.EncodedJwt { tokenStr := "" - lookupUrl := fmt.Sprintf("http://%s/dir/lookup?fileId=%s", master, fileId) - err := util.Head(lookupUrl, func(header fasthttp.ResponseHeader) { - bearer := header.Peek("Authorization") - if len(bearer) > 7 && string(bytes.ToUpper(bearer[0:6])) == "BEARER" { - tokenStr = string(bearer[7:]) + if h, e := util.Head(fmt.Sprintf("http://%s/dir/lookup?fileId=%s", master, fileId)); e == nil { + bearer := h.Get("Authorization") + if len(bearer) > 7 && strings.ToUpper(bearer[0:6]) == "BEARER" { + tokenStr = bearer[7:] } - }) - if err != nil { - glog.V(0).Infof("failed to lookup jwt %s: %v", lookupUrl, err) } return security.EncodedJwt(tokenStr) |
