瀏覽代碼

Prevent sending empty Content-Type header

kiska-2021
JustAnotherArchivist 3 年之前
父節點
當前提交
11aec07c2e
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. +6
    -2
      server/handlers.go

+ 6
- 2
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 {


Loading…
取消
儲存