|
|
@ -215,7 +215,7 @@ func HTTP(ctx *middleware.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HTTPBackend(&Config{ |
|
|
|
HTTPBackend(ctx, &Config{ |
|
|
|
RepoRootPath: setting.RepoRootPath, |
|
|
|
RepoRootPath: setting.RepoRootPath, |
|
|
|
GitBinPath: "git", |
|
|
|
GitBinPath: "git", |
|
|
|
UploadPack: true, |
|
|
|
UploadPack: true, |
|
|
@ -286,7 +286,7 @@ func getGitDir(config *Config, fPath string) (string, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Request handling function
|
|
|
|
// Request handling function
|
|
|
|
func HTTPBackend(config *Config) http.HandlerFunc { |
|
|
|
func HTTPBackend(ctx *middleware.Context, config *Config) http.HandlerFunc { |
|
|
|
return func(w http.ResponseWriter, r *http.Request) { |
|
|
|
return func(w http.ResponseWriter, r *http.Request) { |
|
|
|
for _, route := range routes { |
|
|
|
for _, route := range routes { |
|
|
|
r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name
|
|
|
|
r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name
|
|
|
@ -300,7 +300,7 @@ func HTTPBackend(config *Config) http.HandlerFunc { |
|
|
|
dir, err := getGitDir(config, m[1]) |
|
|
|
dir, err := getGitDir(config, m[1]) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.GitLogger.Error(4, err.Error()) |
|
|
|
log.GitLogger.Error(4, err.Error()) |
|
|
|
renderNotFound(w) |
|
|
|
ctx.Handle(404, "HTTPBackend", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -309,7 +309,7 @@ func HTTPBackend(config *Config) http.HandlerFunc { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderNotFound(w) |
|
|
|
ctx.Handle(404, "HTTPBackend", nil) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -433,8 +433,6 @@ func sendFile(contentType string, hr handler) { |
|
|
|
w, r := hr.w, hr.r |
|
|
|
w, r := hr.w, hr.r |
|
|
|
reqFile := path.Join(hr.Dir, hr.File) |
|
|
|
reqFile := path.Join(hr.Dir, hr.File) |
|
|
|
|
|
|
|
|
|
|
|
// fmt.Println("sendFile:", reqFile)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f, err := os.Stat(reqFile) |
|
|
|
f, err := os.Stat(reqFile) |
|
|
|
if os.IsNotExist(err) { |
|
|
|
if os.IsNotExist(err) { |
|
|
|
renderNotFound(w) |
|
|
|
renderNotFound(w) |
|
|
|