Deleted
Added
nxt_php_sapi.c (1091:2a71417d297f) | nxt_php_sapi.c (1102:29421134ed99) |
---|---|
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" --- 166 unchanged lines hidden (view full) --- 175#ifdef ZTS 176static void ***tsrm_ls; 177#endif 178 179 180static nxt_int_t 181nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf) 182{ | 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" --- 166 unchanged lines hidden (view full) --- 175#ifdef ZTS 176static void ***tsrm_ls; 177#endif 178 179 180static nxt_int_t 181nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf) 182{ |
183 u_char *p; | 183 u_char *p, *tmp; |
184 nxt_str_t ini_path; 185 nxt_str_t *root, *script_filename, *script_name, *index; 186 nxt_port_t *my_port, *main_port; 187 nxt_runtime_t *rt; 188 nxt_unit_ctx_t *unit_ctx; 189 nxt_unit_init_t php_init; 190 nxt_conf_value_t *value; 191 nxt_php_app_conf_t *c; --- 24 unchanged lines hidden (view full) --- 216 217 root->length = nxt_strlen(root->start); 218 219 nxt_php_str_trim_trail(root, '/'); 220 221 if (c->script.length > 0) { 222 nxt_php_str_trim_lead(&c->script, '/'); 223 | 184 nxt_str_t ini_path; 185 nxt_str_t *root, *script_filename, *script_name, *index; 186 nxt_port_t *my_port, *main_port; 187 nxt_runtime_t *rt; 188 nxt_unit_ctx_t *unit_ctx; 189 nxt_unit_init_t php_init; 190 nxt_conf_value_t *value; 191 nxt_php_app_conf_t *c; --- 24 unchanged lines hidden (view full) --- 216 217 root->length = nxt_strlen(root->start); 218 219 nxt_php_str_trim_trail(root, '/'); 220 221 if (c->script.length > 0) { 222 nxt_php_str_trim_lead(&c->script, '/'); 223 |
224 p = nxt_malloc(root->length + 1 + c->script.length + 1); 225 if (nxt_slow_path(p == NULL)) { | 224 tmp = nxt_malloc(root->length + 1 + c->script.length + 1); 225 if (nxt_slow_path(tmp == NULL)) { |
226 return NXT_ERROR; 227 } 228 | 226 return NXT_ERROR; 227 } 228 |
229 p = tmp; 230 |
|
229 p = nxt_cpymem(p, root->start, root->length); 230 *p++ = '/'; 231 232 p = nxt_cpymem(p, c->script.start, c->script.length); 233 *p = '\0'; 234 | 231 p = nxt_cpymem(p, root->start, root->length); 232 *p++ = '/'; 233 234 p = nxt_cpymem(p, c->script.start, c->script.length); 235 *p = '\0'; 236 |
235 script_filename->start = nxt_realpath(p); | 237 script_filename->start = nxt_realpath(tmp); |
236 if (nxt_slow_path(script_filename->start == NULL)) { | 238 if (nxt_slow_path(script_filename->start == NULL)) { |
237 nxt_alert(task, "script realpath(%s) failed %E", p, nxt_errno); | 239 nxt_alert(task, "script realpath(%s) failed %E", tmp, nxt_errno); |
238 return NXT_ERROR; 239 } 240 | 240 return NXT_ERROR; 241 } 242 |
241 nxt_free(p); | 243 nxt_free(tmp); |
242 243 script_filename->length = nxt_strlen(script_filename->start); 244 245 if (!nxt_str_start(script_filename, root->start, root->length)) { 246 nxt_alert(task, "script is not under php root"); 247 return NXT_ERROR; 248 } 249 --- 769 unchanged lines hidden --- | 244 245 script_filename->length = nxt_strlen(script_filename->start); 246 247 if (!nxt_str_start(script_filename, root->start, root->length)) { 248 nxt_alert(task, "script is not under php root"); 249 return NXT_ERROR; 250 } 251 --- 769 unchanged lines hidden --- |