summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorRachid Zarouali <xinity@users.noreply.github.com>2016-11-07 11:23:30 +0100
committerGitHub <noreply@github.com>2016-11-07 11:23:30 +0100
commitbe5607e510f410ac82247c3b4b8a4bc6504e7cee (patch)
tree7e00b2e24482ff795085418e3891fb45c4e9cee4 /routers
parent5a6f7edde97c5ff9811bbc79f5f5fc4c16703683 (diff)
parente54dec7ce518b170ec148f1c35bc1e5ad174dc2b (diff)
downloadgitea-be5607e510f410ac82247c3b4b8a4bc6504e7cee.tar.gz
gitea-be5607e510f410ac82247c3b4b8a4bc6504e7cee.zip
Merge pull request #50 from 0xbaadf00d/feature/2583-disablehttpcloning
Disable HTTP cloning
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/http.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 36e53008d8..529dc3d348 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)