debugserver: handle wildcard pprof requests
Created by: flying-robot
@tsenart and I found while pairing that some pprof endpoints in debugserver would result in a 404. We traced it back and found that the router had switched[0] from the stdlib to gorilla/mux. The latter is explicit in its route handling, so shifting to PathPrefix
and moving it further down the list will fix the problem.
On main:
$ curl -s -o /dev/null -w "%{http_code}" http://sourcegraph.test:6074/debug/pprof/goroutine\?debug\=1
404
$ curl -s -o /dev/null -w "%{http_code}" http://sourcegraph.test:6074/debug/pprof/mutex\?debug\=1
404
...
With this change:
$ curl -s -o /dev/null -w "%{http_code}" http://sourcegraph.test:6074/debug/pprof/goroutine\?debug\=1
200
$ curl -s -o /dev/null -w "%{http_code}" http://sourcegraph.test:6074/debug/pprof/mutex\?debug\=1
200
...