Skip to content

Comments

refactor(pprof): use explicit mux instead of DefaultServeMux#36276

Merged
wxiaoguang merged 3 commits intogo-gitea:mainfrom
luojiyin1987:web/pprof-explicit-mux
Jan 2, 2026
Merged

refactor(pprof): use explicit mux instead of DefaultServeMux#36276
wxiaoguang merged 3 commits intogo-gitea:mainfrom
luojiyin1987:web/pprof-explicit-mux

Conversation

@luojiyin1987
Copy link
Contributor

Summary

  • Replace blank import of net/http/pprof with explicit import
  • Create dedicated http.ServeMux for pprof server
  • Register pprof handlers explicitly

Why

  • Improves isolation: pprof no longer pollutes global DefaultServeMux
  • Improves maintainability: explicit handler registration is clearer
  • Improves security: avoids accidental exposure via DefaultServeMux

Changes

  • cmd/web.go: Replace http.DefaultServeMux with explicit http.NewServeMux()

  - Replace blank import of net/http/pprof with explicit import
  - Create dedicated http.ServeMux for pprof server
  - Register pprof handlers explicitly
  - Improves isolation and maintainability

Signed-off-by: luojiyin <luojiyin@hotmail.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 1, 2026
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin labels Jan 1, 2026
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 2, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 2, 2026
@wxiaoguang wxiaoguang enabled auto-merge (squash) January 2, 2026 07:35
@wxiaoguang wxiaoguang merged commit d2baa81 into go-gitea:main Jan 2, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Jan 2, 2026
@luojiyin1987 luojiyin1987 deleted the web/pprof-explicit-mux branch January 2, 2026 08:50
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 5, 2026
* giteaofficial/main:
  Move assign project when creating pull request to the same database transaction (go-gitea#36244)
  [skip ci] Updated translations via Crowdin
  Fix stats bug when syncing release (go-gitea#36285)
  Fix link/origin referrer and login redirect (go-gitea#36279)
  Always honor user's choice for "delete branch after merge" (go-gitea#36281)
  refactor(pprof): use explicit mux instead of DefaultServeMux (go-gitea#36276)
  improve the compare page (go-gitea#36261)
  mailer: pass request context to generateAdditionalHeadersForIssue (go-gitea#36274)
  feat(debian): use explicit, stronger defaults for newly generated repo signing keys (go-gitea#36236)
  Make "commit statuses" API accept slashes in "ref" (go-gitea#36264)

# Conflicts:
#	templates/base/footer_content.tmpl
#	templates/base/head_navbar.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants