summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcaddyconfig/caddyfile/parse.go5
-rwxr-xr-xcaddyconfig/caddyfile/parse_test.go4
2 files changed, 9 insertions, 0 deletions
diff --git a/caddyconfig/caddyfile/parse.go b/caddyconfig/caddyfile/parse.go
index 96491bb..d870765 100755
--- a/caddyconfig/caddyfile/parse.go
+++ b/caddyconfig/caddyfile/parse.go
@@ -214,6 +214,11 @@ func (p *parser) addresses() error {
break
}
+ // Users commonly forget to place a space between the address and the '{'
+ if strings.HasSuffix(tkn, "{") {
+ return p.Errf("Site addresses cannot end with a curly brace: '%s' - put a space between the token and the brace", tkn)
+ }
+
if tkn != "" { // empty token possible if user typed ""
// Trailing comma indicates another address will follow, which
// may possibly be on the next line
diff --git a/caddyconfig/caddyfile/parse_test.go b/caddyconfig/caddyfile/parse_test.go
index 3c7db79..12c7139 100755
--- a/caddyconfig/caddyfile/parse_test.go
+++ b/caddyconfig/caddyfile/parse_test.go
@@ -160,6 +160,10 @@ func TestParseOneAndImport(t *testing.T) {
"localhost",
}, []int{}},
+ {`localhost{
+ dir1
+ }`, true, []string{}, []int{}},
+
{`localhost
dir1 {
nested {