nxt_php_sapi.c (20:4dc92b438f58) nxt_php_sapi.c (65:10688b89aa16)
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

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

162}
163
164
165nxt_int_t
166nxt_php_request_init(nxt_app_request_t *r)
167{
168 nxt_php_ctx_t *ctx;
169
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

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

162}
163
164
165nxt_int_t
166nxt_php_request_init(nxt_app_request_t *r)
167{
168 nxt_php_ctx_t *ctx;
169
170 ctx = nxt_mem_zalloc(r->mem_pool, sizeof(nxt_php_ctx_t));
170 ctx = nxt_mp_zget(r->mem_pool, sizeof(nxt_php_ctx_t));
171 if (nxt_slow_path(ctx == NULL)) {
172 return NXT_ERROR;
173 }
174
175 r->ctx = ctx;
176
177 return NXT_OK;
178}

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

256 - ctx->query.data;
257
258 } else {
259 ctx->script_name_len = r->header.path.len;
260 }
261
262#if !ABS_MODE
263 ctx->script.len = sizeof(root) - 1 + ctx->script_name_len;
171 if (nxt_slow_path(ctx == NULL)) {
172 return NXT_ERROR;
173 }
174
175 r->ctx = ctx;
176
177 return NXT_OK;
178}

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

256 - ctx->query.data;
257
258 } else {
259 ctx->script_name_len = r->header.path.len;
260 }
261
262#if !ABS_MODE
263 ctx->script.len = sizeof(root) - 1 + ctx->script_name_len;
264 ctx->script.data = nxt_mem_nalloc(r->mem_pool, ctx->script.len + 1);
264 ctx->script.data = nxt_mp_nget(r->mem_pool, ctx->script.len + 1);
265
266 if (nxt_slow_path(ctx->script.data == NULL)) {
267 return NXT_ERROR;
268 }
269
270 p = nxt_cpymem(ctx->script.data, root, sizeof(root) - 1);
271 p = nxt_cpymem(p, r->header.path.data, ctx->script_name_len);
272 *p = '\0';

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

560 }
561
562 if (ctx->content_length != NULL) {
563 php_register_variable_safe((char *) "CONTENT_LENGTH",
564 (char *) ctx->content_length->data,
565 ctx->content_length->len, track_vars_array TSRMLS_CC);
566 }
567
265
266 if (nxt_slow_path(ctx->script.data == NULL)) {
267 return NXT_ERROR;
268 }
269
270 p = nxt_cpymem(ctx->script.data, root, sizeof(root) - 1);
271 p = nxt_cpymem(p, r->header.path.data, ctx->script_name_len);
272 *p = '\0';

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

560 }
561
562 if (ctx->content_length != NULL) {
563 php_register_variable_safe((char *) "CONTENT_LENGTH",
564 (char *) ctx->content_length->data,
565 ctx->content_length->len, track_vars_array TSRMLS_CC);
566 }
567
568 var = nxt_mem_nalloc(r->mem_pool, sizeof(prefix) + ctx->max_name + 1);
568 var = nxt_mp_nget(r->mem_pool, sizeof(prefix) + ctx->max_name + 1);
569
570 if (nxt_slow_path(var == NULL)) {
571 return;
572 }
573
574 nxt_memcpy(var, prefix, sizeof(prefix));
575
576 for (i = 0; i < r->header.fields_num; i++) {

--- 35 unchanged lines hidden ---
569
570 if (nxt_slow_path(var == NULL)) {
571 return;
572 }
573
574 nxt_memcpy(var, prefix, sizeof(prefix));
575
576 for (i = 0; i < r->header.fields_num; i++) {

--- 35 unchanged lines hidden ---