nxt_php_sapi.c (1320:4e70411b9842) nxt_php_sapi.c (1345:e40027481af0)
1/*
2 * Copyright (C) Max Romanov
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

--- 585 unchanged lines hidden (view full) ---

594 ctx->req = req;
595
596 r = req->request;
597
598 path.length = r->path_length;
599 path.start = nxt_unit_sptr_get(&r->path);
600
601 if (nxt_php_script_filename.start == NULL) {
1/*
2 * Copyright (C) Max Romanov
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

--- 585 unchanged lines hidden (view full) ---

594 ctx->req = req;
595
596 r = req->request;
597
598 path.length = r->path_length;
599 path.start = nxt_unit_sptr_get(&r->path);
600
601 if (nxt_php_script_filename.start == NULL) {
602 nxt_str_null(&script_name);
603
602 ctx->path_info.start = (u_char *) strstr((char *) path.start, ".php/");
603 if (ctx->path_info.start != NULL) {
604 ctx->path_info.start += 4;
605 path.length = ctx->path_info.start - path.start;
606
607 ctx->path_info.length = r->path_length - path.length;
604 ctx->path_info.start = (u_char *) strstr((char *) path.start, ".php/");
605 if (ctx->path_info.start != NULL) {
606 ctx->path_info.start += 4;
607 path.length = ctx->path_info.start - path.start;
608
609 ctx->path_info.length = r->path_length - path.length;
608 }
609
610
610 if (path.start[path.length - 1] == '/') {
611 } else if (path.start[path.length - 1] == '/') {
611 script_name = nxt_php_index;
612
613 } else {
612 script_name = nxt_php_index;
613
614 } else {
614 script_name.length = 0;
615 script_name.start = NULL;
615 if (nxt_slow_path(path.length < 4
616 || nxt_memcmp(path.start + (path.length - 4),
617 ".php", 4)))
618 {
619 nxt_unit_request_done(req, NXT_UNIT_ERROR);
620
621 return;
622 }
616 }
617
618 ctx->script_filename.length = nxt_php_root.length + path.length
619 + script_name.length;
620 p = nxt_malloc(ctx->script_filename.length + 1);
621 if (nxt_slow_path(p == NULL)) {
622 nxt_unit_request_done(req, NXT_UNIT_ERROR);
623

--- 398 unchanged lines hidden ---
623 }
624
625 ctx->script_filename.length = nxt_php_root.length + path.length
626 + script_name.length;
627 p = nxt_malloc(ctx->script_filename.length + 1);
628 if (nxt_slow_path(p == NULL)) {
629 nxt_unit_request_done(req, NXT_UNIT_ERROR);
630

--- 398 unchanged lines hidden ---