summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/encode/gzip
diff options
context:
space:
mode:
authorKlaus Post <klauspost@gmail.com>2021-06-18 10:49:49 -0700
committerGitHub <noreply@github.com>2021-06-18 11:49:49 -0600
commit69c914483d448cae05ebc4b658a331682532d3d3 (patch)
treed3e62d7f9e2d1fa2d2a4ab9b83d54c6b8fedd443 /modules/caddyhttp/encode/gzip
parent9d4ed3a3236df06e54c80c4f6633b66d68ad3673 (diff)
encode: Tweak compression settings (#4215)
* Tweak compression settings zstd: Limit window sizes to 128K to keep memory in control both server and client size. zstd: Write 0 length frames. This may be needed for compatibility. zstd: Create fewer encoders. Small memory improvement. gzip: Allow -2 (Huffman only) and -3 (stateless) compression modes. * Update modules/caddyhttp/encode/zstd/zstd.go Update docs. Co-authored-by: Francis Lavoie <lavofr@gmail.com> Co-authored-by: Francis Lavoie <lavofr@gmail.com>
Diffstat (limited to 'modules/caddyhttp/encode/gzip')
-rw-r--r--modules/caddyhttp/encode/gzip/gzip.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/caddyhttp/encode/gzip/gzip.go b/modules/caddyhttp/encode/gzip/gzip.go
index 8215b3f..0212583 100644
--- a/modules/caddyhttp/encode/gzip/gzip.go
+++ b/modules/caddyhttp/encode/gzip/gzip.go
@@ -15,7 +15,6 @@
package caddygzip
import (
- "compress/flate"
"fmt"
"strconv"
@@ -68,11 +67,11 @@ func (g *Gzip) Provision(ctx caddy.Context) error {
// Validate validates g's configuration.
func (g Gzip) Validate() error {
- if g.Level < flate.NoCompression {
- return fmt.Errorf("quality too low; must be >= %d", flate.NoCompression)
+ if g.Level < gzip.StatelessCompression {
+ return fmt.Errorf("quality too low; must be >= %d", gzip.StatelessCompression)
}
- if g.Level > flate.BestCompression {
- return fmt.Errorf("quality too high; must be <= %d", flate.BestCompression)
+ if g.Level > gzip.BestCompression {
+ return fmt.Errorf("quality too high; must be <= %d", gzip.BestCompression)
}
return nil
}