From 92e9797fe92ae1aafbd134e230352249902ef45c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 4 Dec 2017 12:49:48 +0000 Subject: [PATCH] close request body --- src/github.com/matrix-org/rageshake/submit.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/github.com/matrix-org/rageshake/submit.go b/src/github.com/matrix-org/rageshake/submit.go index 318404e..0817e2c 100644 --- a/src/github.com/matrix-org/rageshake/submit.go +++ b/src/github.com/matrix-org/rageshake/submit.go @@ -83,6 +83,10 @@ type submitResponse struct { } func (s *submitServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { + // if we attempt to return a response without reading the request body, + // haproxy gets upset and returns a 500. Let's try this. + defer req.Body.Close() + if req.Method != "POST" && req.Method != "OPTIONS" { respond(405, w) return