From d6d7511699f6a35e3246918023af5ba3bc2cbc67 Mon Sep 17 00:00:00 2001 From: "Y.Horie" Date: Sun, 22 Jan 2023 02:22:36 +0900 Subject: httpcaddyfile: Warn on importing empty file; skip dotfiles (#5320) * httpcaddyfile: Change the parse rules when empty file or dotfile with a glob. * Fixes #5295 * Empty file should just log a warning, and result in no tokens. * The last segment of the path is '*', it should skip any dotfiles. * The last segment of the path is '.*', it should read all dotfiles in a dir. * httpcaddyfile: Regard empty files as import files which include only white space. --- caddyconfig/caddyfile/testdata/empty.txt | 0 caddyconfig/caddyfile/testdata/glob/.dotfile.txt | 4 ++++ caddyconfig/caddyfile/testdata/glob/import_test1.txt | 2 ++ caddyconfig/caddyfile/testdata/only_white_space.txt | 7 +++++++ 4 files changed, 13 insertions(+) create mode 100644 caddyconfig/caddyfile/testdata/empty.txt create mode 100644 caddyconfig/caddyfile/testdata/glob/.dotfile.txt create mode 100644 caddyconfig/caddyfile/testdata/glob/import_test1.txt create mode 100644 caddyconfig/caddyfile/testdata/only_white_space.txt (limited to 'caddyconfig/caddyfile/testdata') diff --git a/caddyconfig/caddyfile/testdata/empty.txt b/caddyconfig/caddyfile/testdata/empty.txt new file mode 100644 index 0000000..e69de29 diff --git a/caddyconfig/caddyfile/testdata/glob/.dotfile.txt b/caddyconfig/caddyfile/testdata/glob/.dotfile.txt new file mode 100644 index 0000000..faab100 --- /dev/null +++ b/caddyconfig/caddyfile/testdata/glob/.dotfile.txt @@ -0,0 +1,4 @@ +host1 { + dir1 + dir2 arg1 +} diff --git a/caddyconfig/caddyfile/testdata/glob/import_test1.txt b/caddyconfig/caddyfile/testdata/glob/import_test1.txt new file mode 100644 index 0000000..dac7b29 --- /dev/null +++ b/caddyconfig/caddyfile/testdata/glob/import_test1.txt @@ -0,0 +1,2 @@ +dir2 arg1 arg2 +dir3 \ No newline at end of file diff --git a/caddyconfig/caddyfile/testdata/only_white_space.txt b/caddyconfig/caddyfile/testdata/only_white_space.txt new file mode 100644 index 0000000..705327c --- /dev/null +++ b/caddyconfig/caddyfile/testdata/only_white_space.txt @@ -0,0 +1,7 @@ + + + + +  + + -- cgit v1.2.3