summaryrefslogtreecommitdiff
path: root/sapi/apache2handler/php_functions.c
diff options
context:
space:
mode:
authorJustin Erenkrantz <jerenkrantz@php.net>2003-02-20 18:20:03 +0000
committerJustin Erenkrantz <jerenkrantz@php.net>2003-02-20 18:20:03 +0000
commit97299303436c52a1ff88960e97e6b1d9573748cd (patch)
tree52806ee59df5455bba18fcd84eb6c5db19cf847f /sapi/apache2handler/php_functions.c
parent63291af1209780089cc3327bc1abbc3105464e3f (diff)
downloadphp-git-97299303436c52a1ff88960e97e6b1d9573748cd.tar.gz
Clean up apache2handler SAPI.
Key improvements: - Be streamy - Re-enable virtual() support - Set content_type correctly - Remove unnecessary code and reintroduce some missing code - Change signature from PhP to PHP
Diffstat (limited to 'sapi/apache2handler/php_functions.c')
-rw-r--r--sapi/apache2handler/php_functions.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 411912f932..20547424be 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -65,39 +65,29 @@ PHP_FUNCTION(virtual)
convert_to_string_ex(filename);
- php_error_docref(NULL TSRMLS_CC, E_ERROR,
- "Virtual Function is not implemented in Apache2Handler '%s' "
- "use SSI instead http://httpd.apache.org/docs-2.0/mod/mod_include.html",
- Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
-
- /* ### this function is unsafe until PHP becomes re-entrant
- * as running virtual('foo.php') from inside another php script
- * can cause bad things to happen.
- * Workaround:
- * Use <!--#include virtual="filename" --> instead, and add the INCLUDES filter
- */
-#ifdef NEVER
+
if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
RETURN_FALSE;
}
-
- if (rr->status == HTTP_OK) {
- if (ap_run_sub_req(rr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
- ap_destroy_sub_req(rr);
- RETURN_FALSE;
- }
+
+ if (rr->status != HTTP_OK) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
ap_destroy_sub_req(rr);
- RETURN_TRUE;
+ RETURN_FALSE;
+ }
+
+ /* Flush everything. */
+ php_end_ob_buffers(1 TSRMLS_CC);
+ php_header();
+
+ if (ap_run_sub_req(rr)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
+ ap_destroy_sub_req(rr);
+ RETURN_FALSE;
}
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
ap_destroy_sub_req(rr);
- RETURN_FALSE;
-#endif
+ RETURN_TRUE;
}
/* */