summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2020-02-06 18:25:25 +0300
committerAndrei Belov <defan@nginx.com>2020-02-06 18:25:25 +0300
commit2dc01938cf02cc05b41a09e618f712129c4cdf91 (patch)
tree556dd40a0ec8c194774d53eed9ff62ed1d25ee7c /src/nxt_php_sapi.c
parent477a58e14010ab14d6ab453860b360cf806f5012 (diff)
parent6e19090736612b39d4c5d0836d7df0722b8955e7 (diff)
downloadunit-2dc01938cf02cc05b41a09e618f712129c4cdf91.tar.gz
unit-2dc01938cf02cc05b41a09e618f712129c4cdf91.tar.bz2
Merged with the default branch.1.15.0-1
Diffstat (limited to '')
-rw-r--r--src/nxt_php_sapi.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index 0f6ce686..26bf915f 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -599,20 +599,27 @@ nxt_php_request_handler(nxt_unit_request_info_t *req)
path.start = nxt_unit_sptr_get(&r->path);
if (nxt_php_script_filename.start == NULL) {
+ nxt_str_null(&script_name);
+
ctx->path_info.start = (u_char *) strstr((char *) path.start, ".php/");
if (ctx->path_info.start != NULL) {
ctx->path_info.start += 4;
path.length = ctx->path_info.start - path.start;
ctx->path_info.length = r->path_length - path.length;
- }
- if (path.start[path.length - 1] == '/') {
+ } else if (path.start[path.length - 1] == '/') {
script_name = nxt_php_index;
} else {
- script_name.length = 0;
- script_name.start = NULL;
+ if (nxt_slow_path(path.length < 4
+ || nxt_memcmp(path.start + (path.length - 4),
+ ".php", 4)))
+ {
+ nxt_unit_request_done(req, NXT_UNIT_ERROR);
+
+ return;
+ }
}
ctx->script_filename.length = nxt_php_root.length + path.length