summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_static.c
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2020-03-12 18:40:48 +0300
committerAndrei Belov <defan@nginx.com>2020-03-12 18:40:48 +0300
commit4b7ca39903178e20ec7381205694cb01f0dec6bc (patch)
tree51afb9c7003b5927183e7ddecd766eb19e421233 /src/nxt_http_static.c
parent8414897527ed1616ea39a0cae4d1b8ee170d5cb8 (diff)
parentb3c8a7b33a29208e75dfe4f670cf81dac7b99ccc (diff)
downloadunit-4b7ca39903178e20ec7381205694cb01f0dec6bc.tar.gz
unit-4b7ca39903178e20ec7381205694cb01f0dec6bc.tar.bz2
Merged with the default branch.1.16.0-1
Diffstat (limited to 'src/nxt_http_static.c')
-rw-r--r--src/nxt_http_static.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c
index 44132859..46ae57a7 100644
--- a/src/nxt_http_static.c
+++ b/src/nxt_http_static.c
@@ -49,6 +49,10 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
if (nxt_slow_path(!nxt_str_eq(r->method, "GET", 3))) {
if (!nxt_str_eq(r->method, "HEAD", 4)) {
+ if (action->u.fallback != NULL) {
+ return action->u.fallback;
+ }
+
nxt_http_request_error(task, r, NXT_HTTP_METHOD_NOT_ALLOWED);
return NULL;
}
@@ -123,6 +127,10 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
break;
}
+ if (level == NXT_LOG_ERR && action->u.fallback != NULL) {
+ return action->u.fallback;
+ }
+
if (status != NXT_HTTP_NOT_FOUND) {
nxt_log(task, level, "open(\"%FN\") failed %E", f->name, f->error);
}
@@ -222,8 +230,13 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
nxt_file_close(task, f);
if (nxt_slow_path(!nxt_is_dir(&fi))) {
+ if (action->u.fallback != NULL) {
+ return action->u.fallback;
+ }
+
nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file",
f->name);
+
nxt_http_request_error(task, r, NXT_HTTP_NOT_FOUND);
return NULL;
}