diff options
author | Kyungmin Bae <williambae1@gmail.com> | 2021-01-14 05:30:46 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 20:30:46 +0000 |
commit | edbc5c86dfda07a0eada0acd7461a610fee00ae3 (patch) | |
tree | 75d2c5e38f84dbef1300d7e142a3a1e443a709bf /routers | |
parent | 954aeefb05ee48a8c4ff6006ea449f313a6b9848 (diff) | |
download | gitea-edbc5c86dfda07a0eada0acd7461a610fee00ae3.tar.gz gitea-edbc5c86dfda07a0eada0acd7461a610fee00ae3.zip |
Use Request.URL.RequestURI() for fcgi (#14312) (#14314)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/routes/chi.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/routes/chi.go b/routers/routes/chi.go index 6e609fc2f8..16fd6ea905 100644 --- a/routers/routes/chi.go +++ b/routers/routes/chi.go @@ -86,14 +86,14 @@ func LoggerHandler(level log.Level) func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { start := time.Now() - _ = log.GetLogger("router").Log(0, level, "Started %s %s for %s", log.ColoredMethod(req.Method), req.RequestURI, req.RemoteAddr) + _ = log.GetLogger("router").Log(0, level, "Started %s %s for %s", log.ColoredMethod(req.Method), req.URL.RequestURI(), req.RemoteAddr) next.ServeHTTP(w, req) ww := middleware.NewWrapResponseWriter(w, req.ProtoMajor) status := ww.Status() - _ = log.GetLogger("router").Log(0, level, "Completed %s %s %v %s in %v", log.ColoredMethod(req.Method), req.RequestURI, log.ColoredStatus(status), log.ColoredStatus(status, http.StatusText(status)), log.ColoredTime(time.Since(start))) + _ = log.GetLogger("router").Log(0, level, "Completed %s %s %v %s in %v", log.ColoredMethod(req.Method), req.URL.RequestURI(), log.ColoredStatus(status), log.ColoredStatus(status, http.StatusText(status)), log.ColoredTime(time.Since(start))) }) } } @@ -107,12 +107,12 @@ func storageHandler(storageSetting setting.Storage, prefix string, objStore stor return } - if !strings.HasPrefix(req.RequestURI, "/"+prefix) { + if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) { next.ServeHTTP(w, req) return } - rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix) + rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+prefix) u, err := objStore.URL(rPath, path.Base(rPath)) if err != nil { if os.IsNotExist(err) || errors.Is(err, os.ErrNotExist) { @@ -139,12 +139,12 @@ func storageHandler(storageSetting setting.Storage, prefix string, objStore stor return } - if !strings.HasPrefix(req.RequestURI, "/"+prefix) { + if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) { next.ServeHTTP(w, req) return } - rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix) + rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+prefix) rPath = strings.TrimPrefix(rPath, "/") fi, err := objStore.Stat(rPath) |