Force output buffers to be flushed, if they're turned on.

If output buffering is turned on, PHP can be a bit slack about sending
the data to the client before closing the connection with exit(). These
changes ensure we call ob_flush() before we leave.  We call @ob_flush()
so we don't get noisy warnings when output buffering is off...
This commit is contained in:
Andrew McMillan committed 2011-11-02 18:43:10 +13:00
1 parent c093419591
commit b50b2d82ea
13 files changed
+24 -23

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ if ( ! @include_once( $code_file ) ) {
$c->messages[] = sprintf('No page found to %s %s%s%s', $action, ($action == 'browse' ? '' : 'a '), $component, ($action == 'browse' ? 's' : ''));
include('page-header.php');
include('page-footer.php');
exit(0);
@ob_flush(); exit(0);
}
include('page-header.php');
+3 -2
View File
@@ -26,6 +26,7 @@ function early_exception_handler($e) {
foreach( $trace AS $k => $v ) {
printf( "%s[%d] %s%s%s()\n", $v['file'], $v['line'], (isset($v['class'])?$v['class']:''), (isset($v['type'])?$v['type']:''), (isset($v['function'])?$v['function']:'') );
}
@ob_flush();
}
set_exception_handler('early_exception_handler');
@@ -89,7 +90,7 @@ if ( ! @include_once('AWLUtilities.php') ) {
}
if ( ! @include_once('AWLUtilities.php') ) {
echo "Could not find the AWL libraries. Are they installed? Check your include_path in php.ini!\n";
exit;
@ob_flush(); exit(0);
}
}
@@ -145,7 +146,7 @@ else if ( @file_exists('config/config.php') ) {
}
else {
include('davical_configuration_missing.php');
exit;
@ob_flush(); exit(0);
}
$config_warnings = trim(ob_get_contents());
ob_end_clean();
+4 -4
View File
@@ -17,17 +17,17 @@ if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^(/favicon.ico|davical.css|(i
else {
fpassthru($fh);
}
exit(0);
@ob_flush(); exit(0);
}
require_once('./always.php');
if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^/\.well-known/(.+)$}', $_SERVER['PATH_INFO'], $matches ) ) {
require ('well-known.php');
exit(0);
@ob_flush(); exit(0);
}
elseif ( isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/autodiscover/autodiscover.xml' ) {
require ('autodiscover-handler.php');
exit(0);
@ob_flush(); exit(0);
}
function logRequestHeaders() {
@@ -102,7 +102,7 @@ if ( ! ($request->IsPrincipal() || isset($request->collection) || $request->meth
$redirect_url = ConstructURL('/caldav.php'.$matches[1]);
dbg_error_log( 'LOG WARNING', 'Redirecting %s for "%s" to "%s"', $request->method, $request->path, $redirect_url );
header('Location: '.$redirect_url );
exit(0);
@ob_flush(); exit(0);
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ if ( $_SERVER['REQUEST_METHOD'] != "GET" && $_SERVER['REQUEST_METHOD'] != "POST"
* If the request is not a GET or POST then they must really want caldav.php!
*/
include("./caldav.php");
exit; // Not that it should return from that!
@ob_flush(); exit(0); // Not that it should return from that!
}
include("./always.php");
+1 -1
View File
@@ -21,7 +21,7 @@ require_once("caldav-PUT-functions.php");
include_once('check_UTF8.php');
if ( !$session->AllowedTo("Admin" ) )
exit;
@ob_flush(); exit(0);
if( function_exists("sync_LDAP") && isset($_POST['Sync_LDAP'])){
sync_LDAP();