Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddyfile: advance cursor for claimed token in NewFromNextTokens() (#2971)
When we append a token to the new dispenser, we need to consume it in the parent, too; otherwise it gets scanned twice, which in this case messed up the nesting count which got decremented once too many times.
Zaq? Wiedmann committed
Jan 9, 2020 at 19:48 UTC
3dcc34d3418d3ef5835eac512a52226e47727cfb
1 file changed
+4
caddyconfig/caddyfile/dispenser.go
+4
@@ -275,6 +275,10 @@ func (d *Dispenser) NewFromNextTokens() *Dispenser {
275
if openedBlock {
276
// include closing brace accordingly
277
tkns = append(tkns, d.Token())
278
+ // since NewFromNextTokens is intended to consume the entire
279
+ // directive, we must call Next() here and consume the closing
280
+ // curly brace
281
+ d.Next()
282
}
283
return NewDispenser(tkns)
284
}