Serve pprof server when debug mode is enabled

This commit is contained in:
WeebDataHoarder
2025-04-08 20:06:28 +02:00
parent 574cf71156
commit 153870acc0

View File

@@ -19,6 +19,7 @@ import (
"log/slog"
"maps"
"net/http"
"net/http/pprof"
"path"
"path/filepath"
"strconv"
@@ -327,6 +328,13 @@ func (state *State) setupRoutes() error {
state.Mux.HandleFunc("/", state.handleRequest)
if state.Settings.Debug {
http.HandleFunc(state.UrlPath+"/debug/pprof/", pprof.Index)
http.HandleFunc(state.UrlPath+"/debug/pprof/profile", pprof.Profile)
http.HandleFunc(state.UrlPath+"/debug/pprof/symbol", pprof.Symbol)
http.HandleFunc(state.UrlPath+"/debug/pprof/trace", pprof.Trace)
}
state.Mux.Handle("GET "+state.UrlPath+"/assets/", http.StripPrefix(state.UrlPath, gzipped.FileServer(gzipped.FS(embed.AssetsFs))))
for _, c := range state.Challenges {