- // Regardless of whether the client asked for "/foo.git" or
- // "/foo/.git", we choose whichever variant exists in our repo
- // root. If neither exists, we won't even bother checking
- // authentication.
- rewrittenPath := ""
- tryDirs := []string{
- "/" + repoName + ".git",
- "/" + repoName + "/.git",
- }
- for _, dir := range tryDirs {
- if fileInfo, err := os.Stat(theConfig.Root + dir); err != nil {
- if !os.IsNotExist(err) {
- statusCode, statusText = http.StatusInternalServerError, err.Error()
- return
- }
- } else if fileInfo.IsDir() {
- rewrittenPath = dir + "/" + pathParts[1]
- break
- }
- }
- if rewrittenPath == "" {
- statusCode, statusText = http.StatusNotFound, "not found"
- return
- }
- r.URL.Path = rewrittenPath
-
- arv, ok := connectionPool.Get().(*arvadosclient.ArvadosClient)
- if !ok || arv == nil {
- statusCode, statusText = http.StatusInternalServerError, "connection pool failed"
+ arv := h.clientPool.Get()
+ if arv == nil {
+ statusCode, statusText = http.StatusInternalServerError, "connection pool failed: "+h.clientPool.Err().Error()