bind := flag.String("bind", "[::]:80", "Address to bind and listen on")
doTLS := flag.Bool("tls", false, "Enable TLS")
noH2 := flag.Bool("no-h2", false, "Disable HTTP/2")
+ noGzip := flag.Bool("no-gzip", false, "Disable gzip compression support")
doSetUID := flag.Int("setuid", 0, "Set that UID after binding the socket")
doSetGID := flag.Int("setgid", 0, "Set that GID after binding the socket")
doSetGIDs := flag.String("setgids", "", "Comma-separated GIDs to set")
}
}()
+ if *noGzip {
+ godlighty.NoGzip = true
+ }
godlighty.BindAddr = *bind
srv := http.Server{
Handler: godlighty.MainHandler,
)
var (
+ NoGzip bool
+
gzPool = sync.Pool{
New: func() any { return gzip.NewWriter(io.Discard) },
}
zstdW.Reset(bufCompressed)
defer zstdW.Close()
wc = &gzipResponseWriter{ResponseWriter: w, Writer: zstdW}
- } else if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
+ } else if !NoGzip && strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
w.Header().Set("Content-Encoding", "gzip")
gz = gzPool.Get().(*gzip.Writer)
defer gzPool.Put(gz)