@marcel91200 / caddy Mirror · read-only / commits / 821a08a6
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 11:45 UTC

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

Francis Lavoie committed Sep 20, 2022 at 10:09 UTC 821a08a6e39ed0e7c43b0271ccf126c194eb6339
3 files changed +3 -3
admin_test.go
+1 -1
@@ -161,7 +161,7 @@ func (fooModule) Stop() error { return nil }
161 func TestETags(t *testing.T) {
162 RegisterModule(fooModule{})
163
164 - if err := Load([]byte(`{"apps": {"foo": {"strField": "abc", "intField": 0}}}`), true); err != nil {
164 + if err := Load([]byte(`{"admin": {"listen": "localhost:2999"}, "apps": {"foo": {"strField": "abc", "intField": 0}}}`), true); err != nil {
165 t.Fatalf("loading: %s", err)
166 }
167
caddyconfig/httpcaddyfile/serveroptions.go
+1 -1
@@ -162,7 +162,7 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) {
162 }
163 serverOpts.Protocols = append(serverOpts.Protocols, proto)
164 }
165 - if d.NextBlock(0) {
165 + if nesting := d.Nesting(); d.NextBlock(nesting) {
166 return nil, d.ArgErr()
167 }
168
caddytest/integration/caddyfile_adapt/global_server_options_single.txt
+1 -1
@@ -12,8 +12,8 @@
12 }
13 max_header_size 100MB
14 log_credentials
15 - strict_sni_host
15 protocols h1 h2 h2c h3
16 + strict_sni_host
17 }
18 }
19