mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
httpcaddyfile: Fix protocols
global option parsing (#5054)
* httpcaddyfile: Fix `protocols` global option parsing When checking for a block, the current nesting must be used, otherwise it returns the wrong thing. * Adjust adapt test to cover the broken behaviour that is now fixed * Fix some admin tests which suddenly run even with -short
This commit is contained in:
parent
e3d04ff86b
commit
821a08a6e3
3 changed files with 3 additions and 3 deletions
|
@ -161,7 +161,7 @@ func (fooModule) Stop() error { return nil }
|
||||||
func TestETags(t *testing.T) {
|
func TestETags(t *testing.T) {
|
||||||
RegisterModule(fooModule{})
|
RegisterModule(fooModule{})
|
||||||
|
|
||||||
if err := Load([]byte(`{"apps": {"foo": {"strField": "abc", "intField": 0}}}`), true); err != nil {
|
if err := Load([]byte(`{"admin": {"listen": "localhost:2999"}, "apps": {"foo": {"strField": "abc", "intField": 0}}}`), true); err != nil {
|
||||||
t.Fatalf("loading: %s", err)
|
t.Fatalf("loading: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) {
|
||||||
}
|
}
|
||||||
serverOpts.Protocols = append(serverOpts.Protocols, proto)
|
serverOpts.Protocols = append(serverOpts.Protocols, proto)
|
||||||
}
|
}
|
||||||
if d.NextBlock(0) {
|
if nesting := d.Nesting(); d.NextBlock(nesting) {
|
||||||
return nil, d.ArgErr()
|
return nil, d.ArgErr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
}
|
}
|
||||||
max_header_size 100MB
|
max_header_size 100MB
|
||||||
log_credentials
|
log_credentials
|
||||||
strict_sni_host
|
|
||||||
protocols h1 h2 h2c h3
|
protocols h1 h2 h2c h3
|
||||||
|
strict_sni_host
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue