Merge pull request #103 from sgotti/gitserver_dont_write_on_error
gitserver: don't return http response/error when calling external git process
This commit is contained in:
commit
33c860e78c
|
@ -207,7 +207,8 @@ func (h *GitSmartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
res, err := InfoRefsResponse(ctx, repoAbsPath, serviceName)
|
res, err := InfoRefsResponse(ctx, repoAbsPath, serviceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
// we cannot return any http error since the http header has already been written
|
||||||
|
h.log.Errorf("git command error: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +219,6 @@ func (h *GitSmartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/x-git-upload-pack-result")
|
w.Header().Set("Content-Type", "application/x-git-upload-pack-result")
|
||||||
|
|
||||||
if err := gitService(ctx, w, body, repoAbsPath, "upload-pack"); err != nil {
|
if err := gitService(ctx, w, body, repoAbsPath, "upload-pack"); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
// we cannot return any http error since the http header has already been written
|
// we cannot return any http error since the http header has already been written
|
||||||
h.log.Errorf("git command error: %v", err)
|
h.log.Errorf("git command error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,6 @@ func (h *GitSmartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/x-git-receive-pack-result")
|
w.Header().Set("Content-Type", "application/x-git-receive-pack-result")
|
||||||
|
|
||||||
if err := gitService(ctx, w, body, repoAbsPath, "receive-pack"); err != nil {
|
if err := gitService(ctx, w, body, repoAbsPath, "receive-pack"); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
// we cannot return any http error since the http header has already been written
|
// we cannot return any http error since the http header has already been written
|
||||||
h.log.Errorf("git command error: %v", err)
|
h.log.Errorf("git command error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue