summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-23 19:25:54 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-23 19:25:54 +0200
commitf8ae67fd783a64391d22084aca97a34fecbf139a (patch)
tree408f4f7e76403710d2c801a97b2379008e8533be
parent245a12a610c235478a1370196b0a5f6e89828480 (diff)
downloadhittpd-f8ae67fd783a64391d22084aca97a34fecbf139a.tar.gz
hittpd-f8ae67fd783a64391d22084aca97a34fecbf139a.tar.xz
hittpd-f8ae67fd783a64391d22084aca97a34fecbf139a.zip
with -P, only list files that will be served
-rw-r--r--hittpd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hittpd.c b/hittpd.c
index 1f943de..0ff16ab 100644
--- a/hittpd.c
+++ b/hittpd.c
@@ -651,6 +651,9 @@ on_message_complete(http_parser *p) {
 			if (fstatat(stream_fd, file, &ist, AT_SYMLINK_NOFOLLOW) < 0)
 				continue;
 
+			if (only_public && !(ist.st_mode & S_IROTH))
+				continue;
+
 			fprintf(stream, "<a href=\"");
 			print_urlencoded(stream, file);
 			fprintf(stream, "%s\">",