From 153870acc0e34a6371016be8dc84bc3c1eb3156d Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:06:28 +0200 Subject: [PATCH] Serve pprof server when debug mode is enabled --- lib/http.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/http.go b/lib/http.go index f2d4371..c8051b6 100644 --- a/lib/http.go +++ b/lib/http.go @@ -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 {