aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/git-lfs-server/main.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/git-lfs-server/main.go b/cmd/git-lfs-server/main.go
index 0379117..e5fd7d1 100644
--- a/cmd/git-lfs-server/main.go
+++ b/cmd/git-lfs-server/main.go
@@ -20,6 +20,7 @@ import (
20 "os/exec" 20 "os/exec"
21 "path" 21 "path"
22 "regexp" 22 "regexp"
23 "runtime/debug"
23 "slices" 24 "slices"
24 "strconv" 25 "strconv"
25 "strings" 26 "strings"
@@ -588,7 +589,15 @@ func (h *handler) handleBatchAPI(w http.ResponseWriter, r *http.Request, repo st
588} 589}
589 590
590func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 591func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
591 ctx := context.WithValue(r.Context(), requestIDKey, xid.New().String()) 592 reqID := xid.New().String()
593 ctx := context.WithValue(r.Context(), requestIDKey, reqID)
594 w.Header().Set("X-Request-Id", reqID)
595
596 defer func() {
597 if r := recover(); r != nil {
598 reqlog(ctx, "Panic when serving request: %s", debug.Stack())
599 }
600 }()
592 601
593 reqPath := os.Getenv("PATH_INFO") 602 reqPath := os.Getenv("PATH_INFO")
594 if reqPath == "" { 603 if reqPath == "" {