diff options
author | Thibault Meyer <meyer.thibault@gmail.com> | 2016-09-18 10:54:33 +0200 |
---|---|---|
committer | Thibault Meyer <meyer.thibault@gmail.com> | 2016-09-18 10:54:33 +0200 |
commit | 9d66497abca96905fbeba53bf8983301710d6064 (patch) | |
tree | a2729e6cdf7f4b7be54cd2cf72a49610835b16ce /routers/repo/http.go | |
parent | 7e15ff9486cde36b76f3d39b7db23f89278acb7d (diff) | |
download | gitea-9d66497abca96905fbeba53bf8983301710d6064.tar.gz gitea-9d66497abca96905fbeba53bf8983301710d6064.zip |
Can disable GIT interactions by HTTP protocol
Diffstat (limited to 'routers/repo/http.go')
-rw-r--r-- | routers/repo/http.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index 80afcec410..47cc199457 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -479,6 +479,11 @@ func HTTPBackend(ctx *context.Context, cfg *serviceConfig) http.HandlerFunc { for _, route := range routes { r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name if m := route.reg.FindStringSubmatch(r.URL.Path); m != nil { + if setting.Repository.DisableHttpGit { + w.WriteHeader(http.StatusForbidden) + w.Write([]byte("Interacting with repositories by HTTP protocol is not allowed")) + return + } if route.method != r.Method { if r.Proto == "HTTP/1.1" { w.WriteHeader(http.StatusMethodNotAllowed) |