From 02f50533c4a476b91e4b39a7a2d052095d970983 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 15 Feb 2022 12:30:51 +0100 Subject: [PATCH] Static: returning 404 when "index" is a non-regular file. Before this patch, if "index" was a file, but not a regular file nor a directory, so it may have been for example a FIFO, Unit returned 404. But if "index" was a directory, Unit returned 301. For consistency, this patch makes Unit return 404 for every non-regular file, including directories. --- src/nxt_http_static.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c index c9483b63..8964dbbf 100644 --- a/src/nxt_http_static.c +++ b/src/nxt_http_static.c @@ -571,7 +571,9 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data) /* Not a file. */ nxt_file_close(task, f); - if (nxt_slow_path(!nxt_is_dir(&fi))) { + if (nxt_slow_path(!nxt_is_dir(&fi) + || shr->start[shr->length - 1] == '/')) + { nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file", f->name);