summaryrefslogtreecommitdiff
path: root/sapi/apache/mod_php4.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-07-21 14:27:56 +0000
committerZeev Suraski <zeev@php.net>2001-07-21 14:27:56 +0000
commit336004f4bc72fb5f1a4f8c992d90673960d74856 (patch)
treed80bc544f0c521734e82cccd5f8fbc81ce8a7e25 /sapi/apache/mod_php4.c
parent931ebe08d7af6f37cb3975dd6fec07449aff0a8f (diff)
downloadphp-git-336004f4bc72fb5f1a4f8c992d90673960d74856.tar.gz
Improved bailout mechanism, supports nested bailouts a-la try..catch
Note: You may *not* return directly from a catch block
Diffstat (limited to 'sapi/apache/mod_php4.c')
-rw-r--r--sapi/apache/mod_php4.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index db90946b53..53ddb92d87 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -506,83 +506,83 @@ static int send_php(request_rec *r, int display_source_mode, char *filename)
return OK;
}
- if (setjmp(EG(bailout))!=0) {
- return OK;
- }
- /* We don't accept OPTIONS requests, but take everything else */
- if (r->method_number == M_OPTIONS) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
+ zend_try {
+ /* We don't accept OPTIONS requests, but take everything else */
+ if (r->method_number == M_OPTIONS) {
+ r->allowed |= (1 << METHODS) - 1;
+ return DECLINED;
+ }
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return DECLINED;
- }
+ /* Make sure file exists */
+ if (filename == NULL && r->finfo.st_mode == 0) {
+ return DECLINED;
+ }
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php4_module);
- if (per_dir_conf) {
- zend_hash_apply((HashTable *) per_dir_conf, (int (*)(void *)) php_apache_alter_ini_entries);
- }
+ per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php4_module);
+ if (per_dir_conf) {
+ zend_hash_apply((HashTable *) per_dir_conf, (int (*)(void *)) php_apache_alter_ini_entries);
+ }
- /* If PHP parser engine has been turned off with an "engine off"
- * directive, then decline to handle this request
- */
- if (!AP(engine)) {
- r->content_type = php_apache_get_default_mimetype(r SLS_CC);
- r->allowed |= (1 << METHODS) - 1;
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
+ /* If PHP parser engine has been turned off with an "engine off"
+ * directive, then decline to handle this request
+ */
+ if (!AP(engine)) {
+ r->content_type = php_apache_get_default_mimetype(r SLS_CC);
+ r->allowed |= (1 << METHODS) - 1;
+ zend_try {
+ zend_ini_deactivate(ELS_C);
+ } zend_end_try();
+ return DECLINED;
+ }
+ if (filename == NULL) {
+ filename = r->filename;
}
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
- /* Apache 1.2 has a more complex mechanism for reading POST data */
+ /* Apache 1.2 has a more complex mechanism for reading POST data */
#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
+ if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
+ zend_try {
+ zend_ini_deactivate(ELS_C);
+ } zend_end_try();
+ return retval;
}
- return retval;
- }
#endif
- if (AP(last_modified)) {
+ if (AP(last_modified)) {
#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
+ if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
+ zend_try {
+ zend_ini_deactivate(ELS_C);
+ } zend_end_try();
+ return retval;
}
- return retval;
- }
#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
+ update_mtime (r, r->finfo.st_mtime);
+ set_last_modified(r);
+ set_etag(r);
#endif
- }
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later in the request. */
- r->content_type = php_apache_get_default_mimetype(r SLS_CC);
+ }
+ /* Assume output will be of the default MIME type. Individual
+ scripts may change this later in the request. */
+ r->content_type = php_apache_get_default_mimetype(r SLS_CC);
- /* Init timeout */
- hard_timeout("send", r);
+ /* Init timeout */
+ hard_timeout("send", r);
- SG(server_context) = r;
-
- php_save_umask();
- add_common_vars(r);
- add_cgi_vars(r);
+ SG(server_context) = r;
+
+ php_save_umask();
+ add_common_vars(r);
+ add_cgi_vars(r);
+
+ init_request_info(SLS_C);
+ apache_php_module_main(r, display_source_mode CLS_CC ELS_CC PLS_CC SLS_CC);
- init_request_info(SLS_C);
- apache_php_module_main(r, display_source_mode CLS_CC ELS_CC PLS_CC SLS_CC);
+ /* Done, restore umask, turn off timeout, close file and return */
+ php_restore_umask();
+ kill_timeout(r);
+ } zend_end_try();
- /* Done, restore umask, turn off timeout, close file and return */
- php_restore_umask();
- kill_timeout(r);
return OK;
}
/* }}} */