Backport #18850 Fix #18849 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
81b29d6263
commit
9d9ccdbe43
1 changed files with 5 additions and 4 deletions
|
@ -103,7 +103,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isWiki := false
|
isWiki := false
|
||||||
var unitType = unit.TypeCode
|
unitType := unit.TypeCode
|
||||||
var wikiRepoName string
|
var wikiRepoName string
|
||||||
if strings.HasSuffix(reponame, ".wiki") {
|
if strings.HasSuffix(reponame, ".wiki") {
|
||||||
isWiki = true
|
isWiki = true
|
||||||
|
@ -456,7 +456,6 @@ func serviceRPC(h serviceHandler, service string) {
|
||||||
if err := h.r.Body.Close(); err != nil {
|
if err := h.r.Body.Close(); err != nil {
|
||||||
log.Error("serviceRPC: Close: %v", err)
|
log.Error("serviceRPC: Close: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if !hasAccess(service, h, true) {
|
if !hasAccess(service, h, true) {
|
||||||
|
@ -467,7 +466,7 @@ func serviceRPC(h serviceHandler, service string) {
|
||||||
h.w.Header().Set("Content-Type", fmt.Sprintf("application/x-git-%s-result", service))
|
h.w.Header().Set("Content-Type", fmt.Sprintf("application/x-git-%s-result", service))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var reqBody = h.r.Body
|
reqBody := h.r.Body
|
||||||
|
|
||||||
// Handle GZIP.
|
// Handle GZIP.
|
||||||
if h.r.Header.Get("Content-Encoding") == "gzip" {
|
if h.r.Header.Get("Content-Encoding") == "gzip" {
|
||||||
|
@ -502,7 +501,9 @@ func serviceRPC(h serviceHandler, service string) {
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
|
if err.Error() != "signal: killed" {
|
||||||
log.Error("Fail to serve RPC(%s) in %s: %v - %s", service, h.dir, err, stderr.String())
|
log.Error("Fail to serve RPC(%s) in %s: %v - %s", service, h.dir, err, stderr.String())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue