From 11aec07c2e67694c7dda883b137aad23a34c38f5 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Mon, 8 Feb 2021 01:42:11 +0000 Subject: [PATCH] Prevent sending empty Content-Type header --- server/handlers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/handlers.go b/server/handlers.go index ef9740f..22ec23e 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -970,7 +970,9 @@ func (s *Server) headHandler(w http.ResponseWriter, r *http.Request) { remainingDownloads, remainingDays := metadata.remainingLimitHeaderValues() - w.Header().Set("Content-Type", contentType) + if contentType != "" { + w.Header().Set("Content-Type", contentType) + } if !useZstd { w.Header().Set("Content-Length", strconv.FormatUint(contentLength, 10)) } @@ -1039,7 +1041,9 @@ func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) { remainingDownloads, remainingDays := metadata.remainingLimitHeaderValues() - w.Header().Set("Content-Type", contentType) + if contentType != "" { + w.Header().Set("Content-Type", contentType) + } if !useZstd { w.Header().Set("Content-Length", strconv.FormatUint(contentLength, 10)) } else {