Lines Matching refs:r
78 request_rec *r; in php_apache_sapi_ub_write() local
82 r = ctx->r; in php_apache_sapi_ub_write()
84 if (ap_rwrite(str, str_length, r) < 0) { in php_apache_sapi_ub_write()
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()
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()
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()
176 ap_set_content_type(ctx->r, apr_pstrdup(ctx->r->pool, ctx->content_type)); in php_apache_sapi_send_headers()
188 request_rec *r; in php_apache_sapi_read_post() local
191 r = ctx->r; in php_apache_sapi_read_post()
201 …while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SU… in php_apache_sapi_read_post()
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()
246 http_cookie = apr_table_get(ctx->r->headers_in, "cookie"); in php_apache_sapi_read_cookies()
262 env_var = apr_table_get(ctx->r->subprocess_env, name); in php_apache_sapi_getenv()
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()
293 request_rec *r; in php_apache_sapi_flush() local
304 r = ctx->r; in php_apache_sapi_flush()
308 r->status = SG(sapi_headers).http_response_code; in php_apache_sapi_flush()
311 if (ap_rflush(r) < 0 || r->connection->aborted) { in php_apache_sapi_flush()
325 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, "%s", msg); in php_apache_sapi_log_message()
329 static void php_apache_sapi_log_message_ex(char *msg, request_rec *r TSRMLS_DC) in php_apache_sapi_log_message_ex()
331 if (r) { in php_apache_sapi_log_message_ex()
332 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, msg, r->filename); in php_apache_sapi_log_message_ex()
341 return ((double) apr_time_as_msec(ctx->r->request_time)) / 1000.0; in php_apache_sapi_get_request_time()
471 static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) in php_apache_request_ctor() argument
476 SG(sapi_headers).http_response_code = !r->status ? HTTP_OK : r->status; in php_apache_request_ctor()
477 SG(request_info).content_type = apr_table_get(r->headers_in, "Content-Type"); in php_apache_request_ctor()
478 SG(request_info).query_string = apr_pstrdup(r->pool, r->args); in php_apache_request_ctor()
479 SG(request_info).request_method = r->method; in php_apache_request_ctor()
480 SG(request_info).proto_num = r->proto_num; in php_apache_request_ctor()
481 SG(request_info).request_uri = apr_pstrdup(r->pool, r->uri); in php_apache_request_ctor()
482 SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename); in php_apache_request_ctor()
483 r->no_local_copy = 1; in php_apache_request_ctor()
485 content_length = (char *) apr_table_get(r->headers_in, "Content-Length"); in php_apache_request_ctor()
488 apr_table_unset(r->headers_out, "Content-Length"); in php_apache_request_ctor()
489 apr_table_unset(r->headers_out, "Last-Modified"); in php_apache_request_ctor()
490 apr_table_unset(r->headers_out, "Expires"); in php_apache_request_ctor()
491 apr_table_unset(r->headers_out, "ETag"); in php_apache_request_ctor()
493 auth = apr_table_get(r->headers_in, "Authorization"); in php_apache_request_ctor()
496 if (SG(request_info).auth_user == NULL && r->user) { in php_apache_request_ctor()
497 SG(request_info).auth_user = estrdup(r->user); in php_apache_request_ctor()
500 ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user); in php_apache_request_ctor()
505 static void php_apache_request_dtor(request_rec *r TSRMLS_DC) in php_apache_request_dtor()
510 static void php_apache_ini_dtor(request_rec *r, request_rec *p TSRMLS_DC) in php_apache_ini_dtor() argument
512 if (strcmp(r->protocol, "INCLUDED")) { in php_apache_ini_dtor()
520 php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module); in php_apache_ini_dtor()
530 ((php_struct *)SG(server_context))->r = p; in php_apache_ini_dtor()
532 apr_pool_cleanup_run(r->pool, (void *)&SG(server_context), php_server_context_cleanup); in php_apache_ini_dtor()
536 static int php_handler(request_rec *r) in php_handler() argument
546 #define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); in php_handler()
548 conf = ap_get_module_config(r->per_dir_config, &php5_module); in php_handler()
552 if (ctx == NULL || (ctx && ctx->request_processed && !strcmp(r->protocol, "INCLUDED"))) { in php_handler()
554 ctx = SG(server_context) = apr_pcalloc(r->pool, sizeof(*ctx)); in php_handler()
559 …apr_pool_cleanup_register(r->pool, (void *)&SG(server_context), php_server_context_cleanup, apr_po… in php_handler()
560 ctx->r = r; in php_handler()
563 parent_req = ctx->r; in php_handler()
564 ctx->r = r; in php_handler()
568 …if (strcmp(r->handler, PHP_MAGIC_TYPE) && strcmp(r->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(r->h… in php_handler()
570 if (!AP2(xbithack) || strcmp(r->handler, "text/html") || !(r->finfo.protection & APR_UEXECUTE)) { in php_handler()
578 if (r->used_path_info == AP_REQ_REJECT_PATH_INFO in php_handler()
579 && r->path_info && r->path_info[0]) { in php_handler()
590 if (r->finfo.filetype == 0) { in php_handler()
591 php_apache_sapi_log_message_ex("script '%s' not found or unable to stat", r TSRMLS_CC); in php_handler()
595 if (r->finfo.filetype == APR_DIR) { in php_handler()
596 php_apache_sapi_log_message_ex("attempt to invoke directory '%s' as script", r TSRMLS_CC); in php_handler()
602 if (r->main == NULL || in php_handler()
604 r->subprocess_env != r->main->subprocess_env in php_handler()
607 ap_add_common_vars(r); in php_handler()
608 ap_add_cgi_vars(r); in php_handler()
614 brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc); in php_handler()
618 if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { in php_handler()
623 parent_req = ctx->r; in php_handler()
629 if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { in php_handler()
640 …if (parent_req && parent_req->status != HTTP_OK && parent_req->status != 413 && strcmp(r->protocol… in php_handler()
644 ctx->r = r; in php_handler()
649 ap_update_mtime(r, r->finfo.mtime); in php_handler()
650 ap_set_last_modified(r); in php_handler()
654 if (strncmp(r->handler, PHP_SOURCE_MAGIC_TYPE, sizeof(PHP_SOURCE_MAGIC_TYPE) - 1) == 0) { in php_handler()
657 highlight_file((char *)r->filename, &syntax_highlighter_ini TSRMLS_CC); in php_handler()
662 zfd.filename = (char *) r->filename; in php_handler()
672 apr_table_set(r->notes, "mod_php_memory_usage", in php_handler()
673 apr_psprintf(ctx->r->pool, "%" APR_SIZE_T_FMT, zend_memory_peak_usage(1 TSRMLS_CC))); in php_handler()
679 php_apache_request_dtor(r TSRMLS_CC); in php_handler()
681 bucket = apr_bucket_eos_create(r->connection->bucket_alloc); in php_handler()
684 rv = ap_pass_brigade(r->output_filters, brigade); in php_handler()
685 if (rv != APR_SUCCESS || r->connection->aborted) { in php_handler()
691 apr_pool_cleanup_run(r->pool, (void *)&SG(server_context), php_server_context_cleanup); in php_handler()
693 ctx->r = parent_req; in php_handler()