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.
This commit is contained in:
@@ -571,7 +571,9 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data)
|
|||||||
/* Not a file. */
|
/* Not a file. */
|
||||||
nxt_file_close(task, f);
|
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",
|
nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file",
|
||||||
f->name);
|
f->name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user