summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcaddyconfig/caddyfile/dispenser.go2
-rw-r--r--caddyconfig/httpcaddyfile/directives.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/caddyconfig/caddyfile/dispenser.go b/caddyconfig/caddyfile/dispenser.go
index de67ee1..6afbd77 100755
--- a/caddyconfig/caddyfile/dispenser.go
+++ b/caddyconfig/caddyfile/dispenser.go
@@ -339,7 +339,7 @@ func (d *Dispenser) Errf(format string, args ...interface{}) error {
// array will become apparent (or worse, hide from you like they
// did me for 3 and a half freaking hours late one night).
func (d *Dispenser) Delete() []Token {
- if d.cursor >= 0 && d.cursor < len(d.tokens)-1 {
+ if d.cursor >= 0 && d.cursor <= len(d.tokens)-1 {
d.tokens = append(d.tokens[:d.cursor], d.tokens[d.cursor+1:]...)
d.cursor--
}
diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go
index f1ce0f1..e56d101 100644
--- a/caddyconfig/httpcaddyfile/directives.go
+++ b/caddyconfig/httpcaddyfile/directives.go
@@ -64,7 +64,8 @@ func RegisterHandlerDirective(dir string, setupFunc UnmarshalHandlerFunc) {
return nil, err
}
if ok {
- h.Dispenser.Delete() // strip matcher token
+ tokens := h.Dispenser.Delete() // strip matcher token
+ h.Dispenser = caddyfile.NewDispenser(tokens)
}
h.Dispenser.Reset() // pretend this lookahead never happened