diff options
author | Matt Holt <[email protected]> | 2024-05-18 14:48:42 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-18 14:48:42 -0600 |
commit | 9ba999141b5ca5adaf45893992f4889629f77a9d (patch) | |
tree | d60dae4fd8896978769353e54c9e438d9ed092be /caddyconfig/httpcaddyfile/serveroptions.go | |
parent | f98f449f05c251da2b25fe96ffb73319b4a7af76 (diff) | |
download | caddy-9ba999141b5ca5adaf45893992f4889629f77a9d.tar.gz caddy-9ba999141b5ca5adaf45893992f4889629f77a9d.zip |
caddyhttp: Trace individual middleware handlers (#6313)
* caddyhttp: Trace individual middleware handlers
* Fix typo
Diffstat (limited to 'caddyconfig/httpcaddyfile/serveroptions.go')
-rw-r--r-- | caddyconfig/httpcaddyfile/serveroptions.go | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/caddyconfig/httpcaddyfile/serveroptions.go b/caddyconfig/httpcaddyfile/serveroptions.go index 18f14996c..4246cd7dc 100644 --- a/caddyconfig/httpcaddyfile/serveroptions.go +++ b/caddyconfig/httpcaddyfile/serveroptions.go @@ -50,6 +50,7 @@ type serverOptions struct { ClientIPHeaders []string ShouldLogCredentials bool Metrics *caddyhttp.Metrics + Trace bool // TODO: EXPERIMENTAL } func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) { @@ -246,39 +247,11 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) { } serverOpts.Metrics = new(caddyhttp.Metrics) - // TODO: DEPRECATED. (August 2022) - case "protocol": - caddy.Log().Named("caddyfile").Warn("DEPRECATED: protocol sub-option will be removed soon") - - for nesting := d.Nesting(); d.NextBlock(nesting); { - switch d.Val() { - case "allow_h2c": - caddy.Log().Named("caddyfile").Warn("DEPRECATED: allow_h2c will be removed soon; use protocols option instead") - - if d.NextArg() { - return nil, d.ArgErr() - } - if sliceContains(serverOpts.Protocols, "h2c") { - return nil, d.Errf("protocol h2c already specified") - } - serverOpts.Protocols = append(serverOpts.Protocols, "h2c") - - case "strict_sni_host": - caddy.Log().Named("caddyfile").Warn("DEPRECATED: protocol > strict_sni_host in this position will be removed soon; move up to the servers block instead") - - if d.NextArg() && d.Val() != "insecure_off" && d.Val() != "on" { - return nil, d.Errf("strict_sni_host only supports 'on' or 'insecure_off', got '%s'", d.Val()) - } - boolVal := true - if d.Val() == "insecure_off" { - boolVal = false - } - serverOpts.StrictSNIHost = &boolVal - - default: - return nil, d.Errf("unrecognized protocol option '%s'", d.Val()) - } + case "trace": + if d.NextArg() { + return nil, d.ArgErr() } + serverOpts.Trace = true default: return nil, d.Errf("unrecognized servers option '%s'", d.Val()) @@ -351,10 +324,17 @@ func applyServerOptions( server.Metrics = opts.Metrics if opts.ShouldLogCredentials { if server.Logs == nil { - server.Logs = &caddyhttp.ServerLogConfig{} + server.Logs = new(caddyhttp.ServerLogConfig) } server.Logs.ShouldLogCredentials = opts.ShouldLogCredentials } + if opts.Trace { + // TODO: THIS IS EXPERIMENTAL (MAY 2024) + if server.Logs == nil { + server.Logs = new(caddyhttp.ServerLogConfig) + } + server.Logs.Trace = opts.Trace + } if opts.Name != "" { nameReplacements[key] = opts.Name |