Explorar el Código

Prevent sending empty Content-Type header

kiska-2021
JustAnotherArchivist hace 3 años
padre
commit
11aec07c2e
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. +6
    -2
      server/handlers.go

+ 6
- 2
server/handlers.go Ver fichero

@@ -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 {


Cargando…
Cancelar
Guardar