mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-13 09:06:41 +00:00
disable_checksum
This commit is contained in:
parent
3e1436d709
commit
b27e79e3c4
3 changed files with 6 additions and 15 deletions
|
|
@ -19,7 +19,7 @@ encode gzip zstd {
|
|||
# Long way with a block for each encoding
|
||||
encode {
|
||||
zstd {
|
||||
checksum false
|
||||
disable_checksum
|
||||
}
|
||||
gzip 5
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue