From 134b8056444d8f417c0eb4163809f9659ffc3317 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 23 Mar 2022 14:34:13 -0400 Subject: caddyfile: Prevent bad block opening tokens (#4655) * caddyfile: Prevent bad block opening tokens * Clarifying comments --- caddyconfig/caddyfile/parse_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'caddyconfig/caddyfile/parse_test.go') diff --git a/caddyconfig/caddyfile/parse_test.go b/caddyconfig/caddyfile/parse_test.go index 8d43e1a..c3f6fa6 100755 --- a/caddyconfig/caddyfile/parse_test.go +++ b/caddyconfig/caddyfile/parse_test.go @@ -191,6 +191,20 @@ func TestParseOneAndImport(t *testing.T) { {``, false, []string{}, []int{}}, + // Unexpected next token after '{' on same line + {`localhost + dir1 { a b }`, true, []string{"localhost"}, []int{}}, + // Workaround with quotes + {`localhost + dir1 "{" a b "}"`, false, []string{"localhost"}, []int{5}}, + + // Unexpected '{}' at end of line + {`localhost + dir1 {}`, true, []string{"localhost"}, []int{}}, + // Workaround with quotes + {`localhost + dir1 "{}"`, false, []string{"localhost"}, []int{2}}, + // import with args {`import testdata/import_args0.txt a`, false, []string{"a"}, []int{}}, {`import testdata/import_args1.txt a b`, false, []string{"a", "b"}, []int{}}, -- cgit v1.2.3