Merge pull request #50 from 0xbaadf00d/feature/2583-disablehttpcloning

Disable HTTP cloning
This commit is contained in:
Rachid Zarouali authored and GitHub committed 2016-11-07 11:23:30 +01:00
commit be5607e510
7 files changed
+40 -12

No files matched your search

+5
View File
@@ -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)