Monorepo for Tangled tangled.org
856
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/git_http: replace proxy with redirects

hopefully this can improve error handling in clones

Signed-off-by: oppiliappan <me@oppi.li>

+4 -9
+4 -9
appview/state/git_http.go
··· 46 46 } 47 47 48 48 service := r.URL.Query().Get("service") 49 - var contentType string 50 - switch service { 51 - case "git-receive-pack": 52 - contentType = "application/x-git-receive-pack-advertisement" 53 - default: 54 - contentType = "application/x-git-upload-pack-advertisement" 49 + if service != "git-receive-pack" { 55 50 go s.notifier.Clone(context.Background(), repo) 56 51 } 57 52 58 53 targetURL := fmt.Sprintf("%s://%s/%s/info/refs?%s", scheme, repo.Knot, repo.RepoIdentifier(), r.URL.RawQuery) 59 - s.proxyRequest(w, r, targetURL, contentType) 54 + http.Redirect(w, r, targetURL, http.StatusTemporaryRedirect) 60 55 } 61 56 62 57 func (s *State) UploadArchive(w http.ResponseWriter, r *http.Request) { ··· 68 63 } 69 64 70 65 targetURL := fmt.Sprintf("%s://%s/%s/git-upload-archive?%s", scheme, repo.Knot, repo.RepoIdentifier(), r.URL.RawQuery) 71 - s.proxyRequest(w, r, targetURL, "application/x-git-upload-archive-result") 66 + http.Redirect(w, r, targetURL, http.StatusTemporaryRedirect) 72 67 } 73 68 74 69 func (s *State) UploadPack(w http.ResponseWriter, r *http.Request) { ··· 80 75 } 81 76 82 77 targetURL := fmt.Sprintf("%s://%s/%s/git-upload-pack?%s", scheme, repo.Knot, repo.RepoIdentifier(), r.URL.RawQuery) 83 - s.proxyRequest(w, r, targetURL, "application/x-git-upload-pack-result") 78 + http.Redirect(w, r, targetURL, http.StatusTemporaryRedirect) 84 79 } 85 80 86 81 func (s *State) ReceivePack(w http.ResponseWriter, r *http.Request) {