Make sure HEAD requests don't Hang when tus version header is missing/incorrect

This commit is contained in:
Naren Venkataraman 2015-11-01 19:50:10 -05:00
parent 4c59ae42b7
commit 613527db25
1 changed files with 2 additions and 1 deletions

View File

@ -168,7 +168,8 @@ func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// GET methods are not checked since a browser may visit this URL and does
// not include this header. This request is not part of the specification.
if r.Method != "GET" && r.Header.Get("Tus-Resumable") != "1.0.0" {
handler.sendError(w, ErrUnsupportedVersion)
header.Set("Content-Length", "0")
w.WriteHeader(http.StatusPreconditionFailed)
return
}