GameStats: Don't deny requests with invalid hash

This commit is contained in:
mkwcat
2024-02-06 19:53:38 -05:00
parent 4dda86651a
commit 1c0aa46524

View File

@@ -18,6 +18,7 @@ import (
func HandleWebRequest(w http.ResponseWriter, r *http.Request) {
logging.Info("GSTATS", aurora.Yellow(r.Method), aurora.Cyan(r.URL), "via", aurora.Cyan(r.Host), "from", aurora.BrightCyan(r.RemoteAddr))
moduleName := "GSTATS:" + r.RemoteAddr
u, err := url.Parse(r.URL.String())
if err != nil {
@@ -66,9 +67,7 @@ func HandleWebRequest(w http.ResponseWriter, r *http.Request) {
expectedHash := hex.EncodeToString(hasher.Sum(nil))
if hash != expectedHash {
logging.Error("GSTATS", "Invalid hash")
replyHTTPError(w, http.StatusUnauthorized, "401 Unauthorized")
return
logging.Warn(moduleName, "Invalid hash")
}
switch subPath {
@@ -76,7 +75,7 @@ func HandleWebRequest(w http.ResponseWriter, r *http.Request) {
response = handleGet2(game, query)
default:
logging.Warn("GSTATS", "Unhandled path:", aurora.Cyan(subPath))
logging.Warn(moduleName, "Unhandled path:", aurora.Cyan(subPath))
}
// Padding to appease DWC