disable_checksum

This commit is contained in:
Sam Ottenhoff 2026-03-21 12:13:49 -04:00
parent 3e1436d709
commit b27e79e3c4
3 changed files with 6 additions and 15 deletions

View file

@ -19,7 +19,7 @@ encode gzip zstd {
# Long way with a block for each encoding
encode {
zstd {
checksum false
disable_checksum
}
gzip 5
}

View file

@ -43,7 +43,7 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
// gzip [<level>]
// zstd [<level>] {
// level <level>
// checksum [<true|false>]
// disable_checksum
// }
// minimum_length <length>
// # response matcher block

View file

@ -16,7 +16,6 @@ package caddyzstd
import (
"fmt"
"strconv"
"github.com/klauspost/compress/zstd"
@ -80,23 +79,15 @@ func (z *Zstd) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
z.Level = args[0]
case "checksum":
args := d.RemainingArgs()
if len(args) > 1 {
case "disable_checksum":
if d.NextArg() {
return d.ArgErr()
}
if z.Checksum != nil {
return d.Err("checksum already specified")
}
enabled := true
if len(args) == 1 {
parsed, err := strconv.ParseBool(args[0])
if err != nil {
return d.Errf("parsing checksum: invalid boolean value %q", args[0])
}
enabled = parsed
}
z.Checksum = &enabled
disabled := false
z.Checksum = &disabled
default:
return d.Errf("unknown subdirective '%s'", d.Val())