MCPcopy Index your code
hub / github.com/tinode/chat / profileHandler

Function profileHandler

server/http_pprof.go:31–45  ·  view source on GitHub ↗
(wrt http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

29}
30
31func profileHandler(wrt http.ResponseWriter, req *http.Request) {
32 wrt.Header().Set("X-Content-Type-Options", "nosniff")
33 wrt.Header().Set("Content-Type", "text/plain; charset=utf-8")
34
35 profileName := strings.TrimPrefix(req.URL.Path, pprofHttpRoot)
36
37 profile := pprof.Lookup(profileName)
38 if profile == nil {
39 servePprofError(wrt, http.StatusNotFound, "Unknown profile '"+profileName+"'")
40 return
41 }
42
43 // Respond with the requested profile.
44 profile.WriteTo(wrt, 2)
45}
46
47func servePprofError(wrt http.ResponseWriter, status int, txt string) {
48 wrt.Header().Set("Content-Type", "text/plain; charset=utf-8")

Callers

nothing calls this directly

Calls 1

servePprofErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…