--- php-4.0.6-orig/sapi/apache/mod_php4.c Wed May 16 20:26:08 2001 +++ php-4.0.6/sapi/apache/mod_php4.c Mon Oct 8 12:11:40 2001 @@ -440,6 +440,37 @@ return mimetype; } +static int php_get_request_handler(request_rec *r, char **target) +{ + HashTable *per_dir_conf; + php_per_dir_entry *per_dir_entry; + char *filename; + + if (!(per_dir_conf = get_module_config(r->per_dir_config, &php4_module))) + return 0; + + if (zend_hash_find(per_dir_conf, "request_handler", sizeof("request_handler")-1, + (void **)&per_dir_entry) == SUCCESS) + { + if (!ap_os_is_path_absolute(per_dir_entry->value)) + { + char *dirnam = ap_pstrdup(r->pool, r->filename); + char *x = strrchr(dirnam, '/'); + + if (x != NULL) + *x = 0; + filename = ap_make_full_path(r->pool, dirnam, per_dir_entry->value); + } + else + filename = ap_pstrdup(r->pool, per_dir_entry->value); + + *target = filename; + return 1; + } + + return 0; +} + static int send_php(request_rec *r, int display_source_mode, char *filename) { int retval; @@ -469,6 +500,9 @@ r->allowed |= (1 << METHODS) - 1; return DECLINED; } + + if (php_get_request_handler(r, &filename)) + r->filename = filename; /* Make sure file exists */ if (filename == NULL && r->finfo.st_mode == 0) {