cvs: php4(apache_hooks) /main SAPI.c SAPI.h main.c /sapi/apache mod_php4.c mod_php4.h php_apache.c sapi_apache.c

From: Date: Wed, 28 Aug 2002 18:56:52 +0000
Subject: cvs: php4(apache_hooks) /main SAPI.c SAPI.h main.c /sapi/apache mod_php4.c mod_php4.h php_apache.c sapi_apache.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13729@lists.php.net to get a copy of this message
gschlossnagle Wed Aug 28 14:56:52 2002 EDT Modified files: (Branch: apache_hooks) /php4/main SAPI.c SAPI.h main.c /php4/sapi/apache mod_php4.c mod_php4.h php_apache.c sapi_apache.c Log: Added wrapper functions for the majority of the apache API_EXPORT functions as class methods for the ApacheRequest objects. broke sapi_activate into two functions to allow for reading of headers/cookies separately from request bodies (POST stuff). Altered some of the send_headers code in mod_php4.c to prevent sending headers twice (since a phpResponseHandler needs to be able to have full freedom for setting headers using the ap_*_header* functions.

Index: php4/main/SAPI.c diff -u php4/main/SAPI.c:1.147.4.1 php4/main/SAPI.c:1.147.4.2 --- php4/main/SAPI.c:1.147.4.1 Mon Aug 26 16:02:18 2002 +++ php4/main/SAPI.c Wed Aug 28 14:56:50 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.c,v 1.147.4.1 2002/08/26 20:02:18 gschlossnagle Exp $ */ +/* $Id: SAPI.c,v 1.147.4.2 2002/08/28 18:56:50 gschlossnagle Exp $ */ #include <ctype.h> #include <sys/stat.h> @@ -278,9 +278,11 @@ /* * Called from php_request_startup() for every request. */ -SAPI_API void sapi_activate(TSRMLS_D) +SAPI_API void sapi_activate_headers_only(TSRMLS_D) { - void (*post_reader_func)(TSRMLS_D); + if (SG(request_info).headers_read == 1) + return; + SG(request_info).headers_read = 1; zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); SG(sapi_headers).send_default_content_type = 1; @@ -289,8 +291,6 @@ */ SG(sapi_headers).http_status_line = NULL; SG(headers_sent) = 0; - SG(read_post_bytes) = 0; - SG(request_info).post_data = NULL; SG(request_info).current_user = NULL; SG(request_info).current_user_length = 0; SG(request_info).no_headers = 0; @@ -303,6 +303,23 @@ } else { SG(request_info).headers_only = 0; } + if (SG(server_context)) { + SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); + if (sapi_module.activate) { + sapi_module.activate(TSRMLS_C); + } + } +} + +SAPI_API void sapi_activate(TSRMLS_D) +{ + void (*post_reader_func)(TSRMLS_D); + SG(headers_sent) = 0; + SG(read_post_bytes) = 0; + SG(request_info).post_data = NULL; + /* It's possible to override this general case in the activate() callback, if + * necessary. + */ SG(rfc1867_uploaded_files) = NULL; if (SG(server_context)) { @@ -337,10 +354,7 @@ } else { SG(request_info).content_type_dup = NULL; } - SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); - if (sapi_module.activate) { - sapi_module.activate(TSRMLS_C); - } + sapi_activate_headers_only(TSRMLS_C); } } @@ -383,6 +397,7 @@ } sapi_send_headers_free(TSRMLS_C); SG(sapi_started) = 0; + SG(request_info).headers_read = 0; } Index: php4/main/SAPI.h diff -u php4/main/SAPI.h:1.85.4.1 php4/main/SAPI.h:1.85.4.2 --- php4/main/SAPI.h:1.85.4.1 Mon Aug 26 16:02:18 2002 +++ php4/main/SAPI.h Wed Aug 28 14:56:50 2002 @@ -83,6 +83,7 @@ zend_bool headers_only; zend_bool no_headers; + zend_bool headers_read; sapi_post_entry *post_entry; Index: php4/main/main.c diff -u php4/main/main.c:1.407.2.3 php4/main/main.c:1.407.2.4 --- php4/main/main.c:1.407.2.3 Mon Aug 26 19:14:21 2002 +++ php4/main/main.c Wed Aug 28 14:56:50 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.407.2.3 2002/08/26 23:14:21 azzit Exp $ */ +/* $Id: main.c,v 1.407.2.4 2002/08/28 18:56:50 gschlossnagle Exp $ */ /* {{{ includes */ @@ -896,7 +896,7 @@ return FAILURE; php_output_activate(TSRMLS_C); - sapi_activate(TSRMLS_C); + sapi_activate_headers_only(TSRMLS_C); php_hash_environment(TSRMLS_C); return retval; @@ -958,7 +958,6 @@ void php_request_shutdown(void *dummy) { TSRMLS_FETCH(); - zend_try { php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC); } zend_end_try(); Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.120.2.6 php4/sapi/apache/mod_php4.c:1.120.2.7 --- php4/sapi/apache/mod_php4.c:1.120.2.6 Wed Aug 28 00:37:36 2002 +++ php4/sapi/apache/mod_php4.c Wed Aug 28 14:56:51 2002 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.120.2.6 2002/08/28 04:37:36 gschlossnagle Exp $ */ +/* $Id: mod_php4.c,v 1.120.2.7 2002/08/28 18:56:51 gschlossnagle Exp $ */ #include "php_apache_http.h" @@ -349,10 +349,14 @@ } ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; - /* check that we haven't sent headers already */ - if(!((request_rec *) SG(server_context))->sent_bodyct) - send_http_header((request_rec *) SG(server_context)); - return SAPI_HEADER_SENT_SUCCESSFULLY; + /* check that we haven't sent headers already, we use our own + * headers_sent since we may send headers at anytime + */ + if(!AP(headers_sent)) { + send_http_header((request_rec *) SG(server_context)); + AP(headers_sent) = 1; + } + return SAPI_HEADER_SENT_SUCCESSFULLY; } /* }}} */ @@ -433,6 +437,7 @@ static void php_apache_request_shutdown(void *dummy) { TSRMLS_FETCH(); + AP(current_hook) = AP_CLEANUP; php_output_set_status(0 TSRMLS_CC); SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */ if(SG(sapi_started)) { @@ -443,6 +448,8 @@ if(AP(setup_env)) { AP(setup_env) = 0; } + AP(current_hook) = AP_WAITING_FOR_REQUEST; + AP(headers_sent) = 0; } /* }}} */ @@ -1137,7 +1144,7 @@ } /* }}} */ -static int php_run_hook(request_rec *r, char *handler) +static int php_run_hook(char *handler, request_rec *r) { zval *ret = NULL; php_per_dir_config *conf; @@ -1171,27 +1178,26 @@ return HTTP_INTERNAL_SERVER_ERROR; } -int php_run_stacked_handler(char *hookname, request_rec *r) { - return php_run_hook(r, hookname); -} static int php_uri_translation(request_rec *r) { php_per_server_config *conf; fprintf(stderr,"HOOK: uri_translation\n"); + AP(current_hook) = AP_URI_TRANS; conf = (php_per_server_config *) get_module_config(r->server->module_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_stacked_handler, r, OK); + return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r, OK); } static int php_header_hook(request_rec *r) { php_per_dir_config *conf; fprintf(stderr,"HOOK: headers\n"); + AP(current_hook) = AP_HEADER_PARSE; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r); } @@ -1199,10 +1205,11 @@ { php_per_dir_config *conf; fprintf(stderr,"HOOK: auth\n"); + AP(current_hook) = AP_AUTHENTICATION; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r, OK); } @@ -1210,10 +1217,11 @@ { php_per_dir_config *conf; fprintf(stderr,"HOOK: access\n"); + AP(current_hook) = AP_ACCESS_CONTROL; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r); } @@ -1222,10 +1230,11 @@ { php_per_dir_config *conf; fprintf(stderr,"HOOK: type-checker\n"); + AP(current_hook) = AP_TYPE_CHECKING; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r, OK); } @@ -1233,10 +1242,11 @@ { php_per_dir_config *conf; fprintf(stderr,"HOOK: fixup\n"); + AP(current_hook) = AP_FIXUP; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r); } @@ -1244,10 +1254,11 @@ { php_per_dir_config *conf; fprintf(stderr,"HOOK: logger\n"); + AP(current_hook) = AP_LOGGING; conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, + (int (*)(void *element, void *)) php_run_hook, r); } @@ -1256,21 +1267,21 @@ php_per_dir_config *conf; php_per_server_config *svr; fprintf(stderr,"HOOK: post-read\n"); - + AP(current_hook) = AP_POST_READ; svr = get_module_config(r->server->module_config, &php4_module); - sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_stacked_handler, r); + sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers, ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_stacked_handler, r); + (int (*)(void *element, void *)) php_run_hook, r); } static int php_response_handler(request_rec *r) { php_per_dir_config *conf; - + AP(current_hook) = AP_RESPONSE; conf = get_module_config(r->per_dir_config, &php4_module); - sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_stacked_handler, r); + sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); } /* {{{ handler_rec php_handlers[] Index: php4/sapi/apache/mod_php4.h diff -u php4/sapi/apache/mod_php4.h:1.14.2.2 php4/sapi/apache/mod_php4.h:1.14.2.3 --- php4/sapi/apache/mod_php4.h:1.14.2.2 Mon Aug 26 16:06:31 2002 +++ php4/sapi/apache/mod_php4.h Wed Aug 28 14:56:51 2002 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.h,v 1.14.2.2 2002/08/26 20:06:31 gschlossnagle Exp $ */ +/* $Id: mod_php4.h,v 1.14.2.3 2002/08/28 18:56:51 gschlossnagle Exp $ */ #ifndef MOD_PHP4_H #define MOD_PHP4_H @@ -32,14 +32,10 @@ long xbithack; long terminate_child; long setup_env; + long current_hook; zend_bool in_request; zend_bool apache_config_loaded; - char *uri_handler; - char *auth_handler; - char *access_handler; - char *type_handler; - char *fixup_handler; - char *logger_handler; + zend_bool headers_sent; } php_apache_info_struct; extern zend_module_entry apache_module_entry; @@ -52,6 +48,19 @@ #define AP(v) (php_apache_info.v) #endif +/* defines for the various stages of the apache request */ +#define AP_WAITING_FOR_REQUEST 0 +#define AP_POST_READ 1 +#define AP_URI_TRANS 2 +#define AP_HEADER_PARSE 3 +#define AP_ACCESS_CONTROL 4 +#define AP_AUTHENTICATION 5 +#define AP_AUTHORIZATION 6 +#define AP_TYPE_CHECKING 7 +#define AP_FIXUP 8 +#define AP_RESPONSE 9 +#define AP_LOGGING 10 +#define AP_CLEANUP 11 #endif /* MOD_PHP4_H */ /* Index: php4/sapi/apache/php_apache.c diff -u php4/sapi/apache/php_apache.c:1.45.4.4 php4/sapi/apache/php_apache.c:1.45.4.5 --- php4/sapi/apache/php_apache.c:1.45.4.4 Wed Aug 28 00:37:36 2002 +++ php4/sapi/apache/php_apache.c Wed Aug 28 14:56:51 2002 @@ -17,7 +17,7 @@ | David Sklar <sklar@student.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_apache.c,v 1.45.4.4 2002/08/28 04:37:36 gschlossnagle Exp $ */ +/* $Id: php_apache.c,v 1.45.4.5 2002/08/28 18:56:51 gschlossnagle Exp $ */ #include "php_apache_http.h" @@ -45,7 +45,6 @@ PHP_FUNCTION(virtual); PHP_FUNCTION(apache_request_headers); PHP_FUNCTION(apache_response_headers); -PHP_FUNCTION(apache_send_http_header); PHP_FUNCTION(apachelog); PHP_FUNCTION(apache_note); PHP_FUNCTION(apache_lookup_uri); @@ -58,7 +57,6 @@ function_entry apache_functions[] = { PHP_FE(virtual, NULL) PHP_FE(apache_request_headers, NULL) - PHP_FE(apache_send_http_header, NULL) PHP_FE(apache_note, NULL) PHP_FE(apache_lookup_uri, NULL) PHP_FE(apache_child_terminate, NULL) @@ -75,13 +73,6 @@ STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateInt, engine, php_apache_info_struct, php_apache_info) STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateInt, last_modified, php_apache_info_struct, php_apache_info) STD_PHP_INI_ENTRY("child_terminate", "0", PHP_INI_ALL, OnUpdateInt, terminate_child, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("uri_handler", NULL, PHP_INI_ALL, OnUpdateString, uri_handler, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("auth_handler", NULL, PHP_INI_ALL, OnUpdateString, auth_handler, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("access_handler", NULL, PHP_INI_ALL, OnUpdateString, access_handler, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("type_handler", NULL, PHP_INI_ALL, OnUpdateString, type_handler, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("fixup_handler", NULL, PHP_INI_ALL, OnUpdateString, fixup_handler, php_apache_info_struct, php_apache_info) - STD_PHP_INI_ENTRY("logger_handler", NULL, PHP_INI_ALL, OnUpdateString, logger_handler, php_apache_info_struct, php_apache_info) - PHP_INI_END() /* }}} */ @@ -106,7 +97,7 @@ zval_ptr_dtor(&z); } -static request_rec *get_apache_request(zval *z) +static request_rec *get_apache_request(pval *z) { request_rec *r; zval **addr; @@ -558,6 +549,8 @@ /* }}} */ +/* {{{ add_header_to_table +*/ static void add_header_to_table(table *t, INTERNAL_FUNCTION_PARAMETERS) { zval *first = NULL; @@ -959,6 +952,222 @@ /* }}} */ +/* http_protocol.h */ + +PHP_FUNCTION(apache_request_send_http_header) +{ + zval *id; + request_rec *r; + + APREQ_GET_REQUEST(id, r); + ap_send_http_header(r); + AP(headers_sent) = 1; + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_basic_http_header) +{ + zval *id; + request_rec *r; + + APREQ_GET_REQUEST(id, r); + + ap_basic_http_header((request_rec *)SG(server_context)); + AP(headers_sent) = 1; + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_send_http_trace) +{ + zval *id; + request_rec *r; + + APREQ_GET_REQUEST(id, r); + + ap_send_http_trace((request_rec *)SG(server_context)); + AP(headers_sent) = 1; + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_send_http_options) +{ + zval *id; + request_rec *r; + + APREQ_GET_REQUEST(id, r); + + ap_send_http_options((request_rec *)SG(server_context)); + AP(headers_sent) = 1; + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_send_error_response) +{ + zval **recursive; + zval *id; + request_rec *r; + int rec; + + TSRMLS_FETCH(); + + switch(ARG_COUNT(ht)) { + case 0: + rec = 0; + break; + case 1: + if(zend_get_parameters_ex(1, &recursive) == FAILURE) { + RETURN_FALSE; + } + convert_to_long_ex(recursive); + rec = Z_LVAL_PP(recursive); + break; + default: + WRONG_PARAM_COUNT; + } + APREQ_GET_REQUEST(id, r); + ap_send_error_response(r, rec); + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_set_content_length) +{ + zval **length; + zval *id; + request_rec *r; + + TSRMLS_FETCH(); + if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &length) == FAILURE) { + WRONG_PARAM_COUNT; + } + APREQ_GET_REQUEST(id, r); + + convert_to_long_ex(length); + ap_set_content_length(r, Z_LVAL_PP(length)); + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_set_keepalive) +{ + zval *id; + request_rec *r; + APREQ_GET_REQUEST(id, r); + ap_set_keepalive(r); + RETURN_TRUE; +} + +/* This stuff should use streams or however this is implemented now + +PHP_FUNCTION(apache_request_send_fd) +{ +} + +PHP_FUNCTION(apache_request_send_fd_length) +{ +} +*/ + +/* These are for overriding default output behaviour */ +PHP_FUNCTION(apache_request_rputs) +{ + zval **buffer; + zval *id; + request_rec *r; + TSRMLS_FETCH(); + + if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &buffer) == FAILURE) { + WRONG_PARAM_COUNT; + } + APREQ_GET_REQUEST(id, r); + convert_to_string_ex(buffer); + ap_rwrite(Z_STRVAL_PP(buffer), Z_STRLEN_PP(buffer), (request_rec*)SG(server_context)); +} + +/* This stuff would be useful for custom POST handlers, + which should be supported. Probably by not using + sapi_activate at all inside a phpResponseHandler + and instead using a builtin composed of the below + calls as a apache_read_request_body() and allow + people to custom craft their own. + +PHP_FUNCTION(apache_request_setup_client_block) +{ +} + +PHP_FUNCTION(apache_request_should_client_block) +{ +} + +PHP_FUNCTION(apache_request_get_client_block) +{ +} + +PHP_FUNCTION(apache_request_discard_request_body) +{ +} +*/ + +/* http_log.h */ + +PHP_FUNCTION(apache_request_log_error) +{ + +} + +PHP_FUNCTION(apache_request_log_rerror) +{ +} + +/* http_main.h */ + +PHP_FUNCTION(apache_request_sub_req_lookup_uri) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_sub_req_lookup_file) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_sub_req_method_uri) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_run_sub_req) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_destroy_sub_req) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_internal_redirect) +{ + RETURN_TRUE; +} + +PHP_FUNCTION(apache_request_send_header_field) +{ + zval **fieldname; + zval **fieldval; + zval *id; + request_rec *r; + + TSRMLS_FETCH(); + if(ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &fieldname, &fieldval) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(fieldname); + convert_to_string_ex(fieldval); + APREQ_GET_REQUEST(id, r); + + ap_send_header_field(r, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(fieldval)); + AP(headers_sent) = 1; +} + /* }}} */ @@ -1016,6 +1225,16 @@ #undef set_last_modified #undef some_auth_required #undef update_mtime +#undef send_http_header +#undef basic_http_header +#undef send_http_trace +#undef send_http_options +#undef send_error_response +#undef set_content_length +#undef set_keepalive +#undef rputs +#undef log_error +#undef log_rerror PHP_FALIAS(auth_name, apache_request_auth_name, NULL) PHP_FALIAS(auth_type, apache_request_auth_type, NULL) PHP_FALIAS(basic_auth_pw, apache_request_basic_auth_pw, NULL) @@ -1029,7 +1248,23 @@ PHP_FALIAS(set_last_modified, apache_request_set_last_modified, NULL) PHP_FALIAS(some_auth_required, apache_request_some_auth_required, NULL) PHP_FALIAS(update_mtime, apache_request_update_mtime, NULL) - + PHP_FALIAS(send_http_header, apache_request_send_http_header, NULL) + PHP_FALIAS(basic_http_header, apache_request_basic_http_header, NULL) + PHP_FALIAS(send_header_field, apache_request_send_header_field, NULL) + PHP_FALIAS(send_http_trace, apache_request_send_http_trace, NULL) + PHP_FALIAS(send_http_options, apache_request_send_http_trace, NULL) + PHP_FALIAS(send_error_response, apache_request_send_error_response, NULL) + PHP_FALIAS(set_content_length, apache_request_set_content_length, NULL) + PHP_FALIAS(set_keepalive, apache_request_set_keepalive, NULL) + PHP_FALIAS(rputs, apache_request_rputs, NULL) + PHP_FALIAS(log_error, apache_request_log_error, NULL) + PHP_FALIAS(log_rerror, apache_request_log_rerror, NULL) + PHP_FALIAS(sub_req_lookup_uri, apache_request_sub_req_lookup_uri, NULL) + PHP_FALIAS(sub_req_lookup_file, apache_request_sub_req_lookup_file, NULL) + PHP_FALIAS(sub_req_method_uri, apache_request_sub_req_method_uri, NULL) + PHP_FALIAS(run_sub_req, apache_request_run_sub_req, NULL) + PHP_FALIAS(destroy_sub_req, apache_request_destroy_sub_req, NULL) + PHP_FALIAS(internal_redirect, apache_request_internal_redirect, NULL) { NULL, NULL, NULL } }; /* }}} */ @@ -1141,7 +1376,7 @@ Get and set Apache request notes */ PHP_FUNCTION(apache_note) { - pval **arg_name, **arg_val; + zval **arg_name, **arg_val; char *note_val; int arg_count = ARG_COUNT(ht); @@ -1370,8 +1605,10 @@ /* {{{ proto array getallheaders(void) - Alias for apache_request_headers() */ +*/ +/* Alias for apache_request_headers() */ /* }}} */ + /* {{{ proto array apache_request_headers(void) Fetch all HTTP request headers */ PHP_FUNCTION(apache_request_headers) @@ -1388,10 +1625,6 @@ } /* }}} */ -PHP_FUNCTION(apache_send_http_header) -{ - ap_send_http_header((request_rec *)SG(server_context)); -} /* {{{ proto bool apache_setenv(string variable, string value [, bool walk_to_top]) Set an Apache subprocess_env variable */ PHP_FUNCTION(apache_setenv) Index: php4/sapi/apache/sapi_apache.c diff -u php4/sapi/apache/sapi_apache.c:1.33.4.3 php4/sapi/apache/sapi_apache.c:1.33.4.4 --- php4/sapi/apache/sapi_apache.c:1.33.4.3 Wed Aug 28 00:37:37 2002 +++ php4/sapi/apache/sapi_apache.c Wed Aug 28 14:56:51 2002 @@ -19,7 +19,7 @@ | Stig Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache.c,v 1.33.4.3 2002/08/28 04:37:37 gschlossnagle Exp $ */ +/* $Id: sapi_apache.c,v 1.33.4.4 2002/08/28 18:56:51 gschlossnagle Exp $ */ #include "php_apache_http.h" @@ -69,10 +69,15 @@ #if PHP_SIGCHILD signal(SIGCHLD, sigchld_handler); #endif - - if (php_request_startup_for_hook(TSRMLS_C) == FAILURE) + if(AP(current_hook) == AP_RESPONSE) { + fprintf(stderr, "in Response\n"); + if (php_request_startup_for_hook(TSRMLS_C) == FAILURE) return FAILURE; - + } + else { + if (php_request_startup_for_hook(TSRMLS_C) == FAILURE) + return FAILURE; + } /* Add PHP_SELF_HOOK - Absolute path */ php_register_variable("PHP_SELF_HOOK", filename, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
« previous php.cvs (#13729) next »