summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-05-19 10:47:06 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2021-05-19 10:47:06 -0600
commitc052162203654d9fcb6f3a40b1c9b376b8e618d1 (patch)
treeed168c63505b98d378d2513b2a235742701d1db9 /caddyconfig
parent7f26a6b3e507cef98c2d4a74384bacf53bc58f57 (diff)
parentb82db994f39c6991d673a7ae9836f5454b1f9668 (diff)
Merge branch '2.4'
Diffstat (limited to 'caddyconfig')
-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 {