Add a Server: header unconditionally.

Previously we wouldn't do it if hostname could not be determined, which
would break git-pages-cli based uploads on those machines.
This commit is contained in:
Catherine
2026-04-14 03:39:12 +00:00
parent fe329d748d
commit 6097a9abb8

View File

@@ -862,6 +862,8 @@ func ServePages(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Server", fmt.Sprintf("git-pages (%s)", hostname))
ObserveData(r.Context(), "server.name", hostname)
}
} else {
w.Header().Add("Server", "git-pages")
}
allowedMethods := []string{"OPTIONS", "HEAD", "GET", "PUT", "PATCH", "DELETE", "POST"}
if r.Method == "OPTIONS" || !slices.Contains(allowedMethods, r.Method) {