Lines Matching refs:ctx

79 	php_struct *ctx;  in php_apache_sapi_ub_write()  local
81 ctx = SG(server_context); in php_apache_sapi_ub_write()
82 r = ctx->r; in php_apache_sapi_ub_write()
94 php_struct *ctx; in php_apache_sapi_header_handler() local
97 ctx = SG(server_context); in php_apache_sapi_header_handler()
101 apr_table_unset(ctx->r->headers_out, sapi_header->header); in php_apache_sapi_header_handler()
105 apr_table_clear(ctx->r->headers_out); in php_apache_sapi_header_handler()
124 if (ctx->content_type) { in php_apache_sapi_header_handler()
125 efree(ctx->content_type); in php_apache_sapi_header_handler()
127 ctx->content_type = estrdup(val); in php_apache_sapi_header_handler()
131 ap_set_content_length(ctx->r, (apr_off_t) _strtoui64(val, (char **)NULL, 10)); in php_apache_sapi_header_handler()
133 ap_set_content_length(ctx->r, (apr_off_t) strtol(val, (char **)NULL, 10)); in php_apache_sapi_header_handler()
136 ap_set_content_length(ctx->r, (apr_off_t) strtol(val, (char **)NULL, 10)); in php_apache_sapi_header_handler()
139 apr_table_set(ctx->r->headers_out, sapi_header->header, val); in php_apache_sapi_header_handler()
141 apr_table_add(ctx->r->headers_out, sapi_header->header, val); in php_apache_sapi_header_handler()
156 php_struct *ctx = SG(server_context); in php_apache_sapi_send_headers() local
159 ctx->r->status = SG(sapi_headers).http_response_code; in php_apache_sapi_send_headers()
164 ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9); in php_apache_sapi_send_headers()
165 ctx->r->proto_num = 1000 + (sline[7]-'0'); in php_apache_sapi_send_headers()
167 apr_table_set(ctx->r->subprocess_env, "force-response-1.0", "true"); in php_apache_sapi_send_headers()
173 if (!ctx->content_type) { in php_apache_sapi_send_headers()
174 ctx->content_type = sapi_get_default_content_type(TSRMLS_C); in php_apache_sapi_send_headers()
176 ap_set_content_type(ctx->r, apr_pstrdup(ctx->r->pool, ctx->content_type)); in php_apache_sapi_send_headers()
177 efree(ctx->content_type); in php_apache_sapi_send_headers()
178 ctx->content_type = NULL; in php_apache_sapi_send_headers()
187 php_struct *ctx = SG(server_context); in php_apache_sapi_read_post() local
191 r = ctx->r; in php_apache_sapi_read_post()
192 brigade = ctx->brigade; in php_apache_sapi_read_post()
218 php_struct *ctx = SG(server_context); in php_apache_sapi_get_stat() local
220 ctx->finfo.st_uid = ctx->r->finfo.user; in php_apache_sapi_get_stat()
221 ctx->finfo.st_gid = ctx->r->finfo.group; in php_apache_sapi_get_stat()
222 ctx->finfo.st_dev = ctx->r->finfo.device; in php_apache_sapi_get_stat()
223 ctx->finfo.st_ino = ctx->r->finfo.inode; in php_apache_sapi_get_stat()
225 ctx->finfo.st_atime.tv_sec = apr_time_sec(ctx->r->finfo.atime); in php_apache_sapi_get_stat()
226 ctx->finfo.st_mtime.tv_sec = apr_time_sec(ctx->r->finfo.mtime); in php_apache_sapi_get_stat()
227 ctx->finfo.st_ctime.tv_sec = apr_time_sec(ctx->r->finfo.ctime); in php_apache_sapi_get_stat()
229 ctx->finfo.st_atime = apr_time_sec(ctx->r->finfo.atime); in php_apache_sapi_get_stat()
230 ctx->finfo.st_mtime = apr_time_sec(ctx->r->finfo.mtime); in php_apache_sapi_get_stat()
231 ctx->finfo.st_ctime = apr_time_sec(ctx->r->finfo.ctime); in php_apache_sapi_get_stat()
234 ctx->finfo.st_size = ctx->r->finfo.size; in php_apache_sapi_get_stat()
235 ctx->finfo.st_nlink = ctx->r->finfo.nlink; in php_apache_sapi_get_stat()
237 return &ctx->finfo; in php_apache_sapi_get_stat()
243 php_struct *ctx = SG(server_context); in php_apache_sapi_read_cookies() local
246 http_cookie = apr_table_get(ctx->r->headers_in, "cookie"); in php_apache_sapi_read_cookies()
255 php_struct *ctx = SG(server_context); in php_apache_sapi_getenv() local
258 if (ctx == NULL) { in php_apache_sapi_getenv()
262 env_var = apr_table_get(ctx->r->subprocess_env, name); in php_apache_sapi_getenv()
270 php_struct *ctx = SG(server_context); in php_apache_sapi_register_variables() local
271 const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); in php_apache_sapi_register_variables()
284 …if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), &new_val… in php_apache_sapi_register_variables()
285 php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC); in php_apache_sapi_register_variables()
292 php_struct *ctx; in php_apache_sapi_flush() local
296 ctx = server_context; in php_apache_sapi_flush()
304 r = ctx->r; in php_apache_sapi_flush()
318 php_struct *ctx; in php_apache_sapi_log_message() local
321 ctx = SG(server_context); in php_apache_sapi_log_message()
323 if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */ in php_apache_sapi_log_message()
326 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, "%s", msg); in php_apache_sapi_log_message()
341 php_struct *ctx = SG(server_context); in php_apache_sapi_get_request_time() local
342 return apr_time_sec(ctx->r->request_time); in php_apache_sapi_get_request_time()
472 static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) in php_apache_request_ctor()
499 ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user); in php_apache_request_ctor()
540 php_struct * volatile ctx; in php_handler() local
553 ctx = SG(server_context); in php_handler()
554 if (ctx == NULL || (ctx && ctx->request_processed && !strcmp(r->protocol, "INCLUDED"))) { in php_handler()
556 ctx = SG(server_context) = apr_pcalloc(r->pool, sizeof(*ctx)); in php_handler()
562 ctx->r = r; in php_handler()
563ctx = NULL; /* May look weird to null it here, but it is to catch the right case in the first_try … in php_handler()
565 parent_req = ctx->r; in php_handler()
566 ctx->r = r; in php_handler()
615 if (ctx == NULL) { in php_handler()
617 ctx = SG(server_context); in php_handler()
618 ctx->brigade = brigade; in php_handler()
620 if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { in php_handler()
625 parent_req = ctx->r; in php_handler()
631 if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { in php_handler()
646 ctx->r = r; in php_handler()
647 brigade = ctx->brigade; in php_handler()
675 apr_psprintf(ctx->r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC))); in php_handler()
682 ctx->request_processed = 1; in php_handler()
694 ctx->r = parent_req; in php_handler()