Answer faster in case of non-supported checksum database

pull/149/head
RainbowMango 2020-03-14 15:33:48 +08:00 committed by kun
parent a7300372df
commit 94fcf94f0a
1 changed files with 10 additions and 5 deletions

View File

@ -35,12 +35,17 @@ func Handler(w http.ResponseWriter, r *http.Request) {
return
}
for _, supported := range supportedSumDB {
uri := fmt.Sprintf("/sumdb/%s/supported", supported)
if r.URL.Path == uri {
w.WriteHeader(http.StatusOK)
return
if strings.HasSuffix(r.URL.Path, "/supported") {
for _, supported := range supportedSumDB {
uri := fmt.Sprintf("/sumdb/%s/supported", supported)
if r.URL.Path == uri {
w.WriteHeader(http.StatusOK)
return
}
}
w.WriteHeader(http.StatusGone)
return
}
p := "https://" + strings.TrimPrefix(r.URL.Path, "/sumdb/")