Skip to content

Commit

Permalink
Answer faster in case of non-supported checksum database
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowMango authored and oiooj committed Mar 14, 2020
1 parent a730037 commit 94fcf94
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions sumdb/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down

0 comments on commit 94fcf94

Please sign in to comment.