correct crc
correct volume id lookup
This commit is contained in:
@@ -47,7 +47,7 @@ func dirLookupHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
volumeId, _ := storage.NewVolumeId(vid)
|
||||
machines := topo.Lookup(volumeId)
|
||||
if machines == nil {
|
||||
if machines != nil {
|
||||
ret := []map[string]string{}
|
||||
for _, dn := range *machines {
|
||||
ret = append(ret, map[string]string{"url": dn.Ip + strconv.Itoa(dn.Port), "publicUrl": dn.PublicUrl})
|
||||
|
||||
@@ -42,7 +42,7 @@ func assign(count int) (*AssignResult, error) {
|
||||
values := make(url.Values)
|
||||
values.Add("count", strconv.Itoa(count))
|
||||
values.Add("replication", *uploadReplication)
|
||||
jsonBlob, err := util.Post("http://"+*server+"/dir/assign2", values)
|
||||
jsonBlob, err := util.Post("http://"+*server+"/dir/assign", values)
|
||||
if *IsDebug {
|
||||
fmt.Println("debug", *IsDebug, "assign result :", string(jsonBlob))
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if err == nil {
|
||||
http.Redirect(w, r, "http://"+lookupResult.Locations[0].PublicUrl+r.URL.Path, http.StatusMovedPermanently)
|
||||
} else {
|
||||
log.Println("lookup error:", err)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
return
|
||||
@@ -89,6 +90,7 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("read bytes", count, "error", e)
|
||||
}
|
||||
if e != nil || count <= 0 {
|
||||
log.Println("read error:", e)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user