diff options
-rw-r--r-- | cmd/web.go | 3 | ||||
-rw-r--r-- | models/repo.go | 2 | ||||
-rw-r--r-- | routers/debug/debug.go | 16 | ||||
-rw-r--r-- | routers/debug/ignored.go | 11 |
4 files changed, 31 insertions, 1 deletions
diff --git a/cmd/web.go b/cmd/web.go index 2f552d8667..0515bcee30 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -26,6 +26,7 @@ import ( "github.com/gogits/gogs/routers" "github.com/gogits/gogs/routers/admin" "github.com/gogits/gogs/routers/api/v1" + "github.com/gogits/gogs/routers/debug" "github.com/gogits/gogs/routers/dev" "github.com/gogits/gogs/routers/org" "github.com/gogits/gogs/routers/repo" @@ -205,6 +206,8 @@ func runWeb(*cli.Context) { r.Post("/:org/settings/delete", org.DeletePost) }, reqSignIn) + debug.RegisterRoutes(m) + m.Group("/:username/:reponame", func(r martini.Router) { r.Get("/settings", repo.Setting) r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost) diff --git a/models/repo.go b/models/repo.go index d95f8b1a71..b7f5ad25ce 100644 --- a/models/repo.go +++ b/models/repo.go @@ -158,7 +158,7 @@ func IsRepositoryExist(u *User, repoName string) (bool, error) { } var ( - illegalEquals = []string{"raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new"} + illegalEquals = []string{"debug", "raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new"} illegalSuffixs = []string{".git"} ) diff --git a/routers/debug/debug.go b/routers/debug/debug.go new file mode 100644 index 0000000000..c332dbea7d --- /dev/null +++ b/routers/debug/debug.go @@ -0,0 +1,16 @@ +// +build pprof
+
+package debug
+
+import (
+ "net/http/pprof"
+
+ "github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+ r.Get("/debug/pprof/cmdline", pprof.Cmdline)
+ r.Get("/debug/pprof/profile", pprof.Profile)
+ r.Get("/debug/pprof/symbol", pprof.Symbol)
+ r.Get("/debug/pprof/**", pprof.Index)
+}
diff --git a/routers/debug/ignored.go b/routers/debug/ignored.go new file mode 100644 index 0000000000..4ec49964b7 --- /dev/null +++ b/routers/debug/ignored.go @@ -0,0 +1,11 @@ +// +build !pprof
+
+package debug
+
+import (
+ "github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+ // do nothing
+}
|