mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Use github.com/klauspost/compress/gzhttp instead of github.com/NYTimes/gziphandler
This commit is contained in:
+4
-3
@@ -4,6 +4,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
gocontext "context"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -48,9 +49,9 @@ import (
|
||||
_ "code.gitea.io/gitea/modules/session" // to registers all internal adapters
|
||||
|
||||
"gitea.com/go-chi/captcha"
|
||||
"github.com/NYTimes/gziphandler"
|
||||
chi_middleware "github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/cors"
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
@@ -241,11 +242,11 @@ func Routes() *web.Route {
|
||||
var mid []any
|
||||
|
||||
if setting.EnableGzip {
|
||||
h, err := gziphandler.GzipHandlerWithOpts(gziphandler.MinSize(GzipMinSize))
|
||||
wrapper, err := gzhttp.NewWrapper(gzhttp.MinSize(GzipMinSize), gzhttp.CompressionLevel(gzip.BestSpeed))
|
||||
if err != nil {
|
||||
log.Fatal("GzipHandlerWithOpts failed: %v", err)
|
||||
}
|
||||
mid = append(mid, h)
|
||||
mid = append(mid, wrapper)
|
||||
}
|
||||
|
||||
if setting.Service.EnableCaptcha {
|
||||
|
||||
Reference in New Issue
Block a user