From 6356b51b33d9f3c6ef8e255146b15e11659ce500 Mon Sep 17 00:00:00 2001 From: Sunny <25066078+LoSunny@users.noreply.github.com> Date: Tue, 14 May 2024 00:24:54 +0800 Subject: [PATCH] serve http: added content-length header when html directory is served --- lib/http/serve/dir.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/http/serve/dir.go b/lib/http/serve/dir.go index 1cfcc454b..664f81cf2 100644 --- a/lib/http/serve/dir.go +++ b/lib/http/serve/dir.go @@ -235,6 +235,7 @@ func (d *Directory) Serve(w http.ResponseWriter, r *http.Request) { Error(d.DirRemote, w, "Failed to render template", err) return } + w.Header().Set("Content-Length", fmt.Sprintf("%d", buf.Len())) _, err = buf.WriteTo(w) if err != nil { Error(d.DirRemote, nil, "Failed to drain template buffer", err)