From af915d7c826f23e5c7ca7eda6a465e3cdced992f Mon Sep 17 00:00:00 2001 From: Naren Venkataraman Date: Sun, 1 Nov 2015 21:10:37 -0500 Subject: [PATCH] Don't return Body for HEAD requests --- handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/handler.go b/handler.go index 77087d9..2eee2d0 100644 --- a/handler.go +++ b/handler.go @@ -245,7 +245,12 @@ func (handler *Handler) headFile(w http.ResponseWriter, r *http.Request) { id := r.URL.Query().Get(":id") info, err := handler.dataStore.GetInfo(id) if err != nil { - handler.sendError(w, err) + status := http.StatusInternalServerError + if os.IsNotExist(err) { + status = http.StatusNotFound + } + w.Header().Set("Content-Length", "0") + w.WriteHeader(status) return }