summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_static.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-02-15 12:30:51 +0100
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-26 19:31:08 +0200
commit02f50533c4a476b91e4b39a7a2d052095d970983 (patch)
tree8d4ed25025b34843d03f153e51c3df24170b1acc /src/nxt_http_static.c
parent27ca67f0df6c7b606c8496b1c57434032b2a577c (diff)
downloadunit-02f50533c4a476b91e4b39a7a2d052095d970983.tar.gz
unit-02f50533c4a476b91e4b39a7a2d052095d970983.tar.bz2
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.
Diffstat (limited to 'src/nxt_http_static.c')
-rw-r--r--src/nxt_http_static.c4
1 files changed, 3 insertions, 1 deletions
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);