frontend: Increase input size allowed

This commit is contained in:
nemunaire 2021-11-29 15:26:47 +01:00
parent c7569b5e54
commit 7896579189
1 changed files with 3 additions and 3 deletions

View File

@ -37,11 +37,11 @@ func (c submissionChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
// Check request type and size
if r.Method != "POST" {
if r.Method != "POST" || r.ContentLength < 0 {
http.Error(w, "{\"errmsg\":\"Requête invalide.\"}", http.StatusBadRequest)
return
} else if r.ContentLength < 0 || r.ContentLength > 2047 {
http.Error(w, "{\"errmsg\":\"Requête trop longue ou de taille inconnue\"}", http.StatusRequestEntityTooLarge)
} else if r.ContentLength > 4097 {
http.Error(w, "{\"errmsg\":\"Requête trop longue\"}", http.StatusRequestEntityTooLarge)
return
}