mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
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:
parent
c093419591
commit
b50b2d82ea
@ -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');
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1201,8 +1201,7 @@ EOSQL;
|
||||
@dbg_error_log("statistics", "Method: %s, Status: %d, Script: %5.3lfs, Queries: %5.3lfs, URL: %s",
|
||||
$this->method, $status, $script_time, $c->total_query_time, $this->path);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
@ob_flush(); exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ class DAViCalSession extends Session
|
||||
|| (isset($c->restrict_admin_port) && $c->restrict_admin_port != $_SERVER['SERVER_PORT'] ) ) {
|
||||
header('Location: caldav.php');
|
||||
dbg_error_log( 'LOG WARNING', 'Access to "%s" via "%s:%d" rejected.', $_SERVER['REQUEST_URI'], $current_domain, $_SERVER['SERVER_PORT'] );
|
||||
exit(0);
|
||||
@ob_flush(); exit(0);
|
||||
}
|
||||
if ( isset($c->restrict_admin_roles) && $roles == '' ) $roles = $c->restrict_admin_roles;
|
||||
if ( $this->logged_in && $roles == '' ) return;
|
||||
@ -156,7 +156,7 @@ class DAViCalSession extends Session
|
||||
}
|
||||
|
||||
include('page-footer.php');
|
||||
exit;
|
||||
@ob_flush(); exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ class HTTPAuthSession {
|
||||
header( $auth_header );
|
||||
echo 'Please log in for access to this system.';
|
||||
dbg_error_log( "HTTPAuth", ":Session: User is not authorised: %s ", $_SERVER['REMOTE_ADDR'] );
|
||||
exit;
|
||||
@ob_flush(); exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -299,7 +299,7 @@ function AuthExternalAWL( $username, $password ) {
|
||||
</body>
|
||||
</html>
|
||||
EOERRMSG;
|
||||
exit(1);
|
||||
@ob_flush(); exit(1);
|
||||
}
|
||||
|
||||
if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) {
|
||||
|
||||
@ -14,7 +14,7 @@ $request = new CalDAVRequest();
|
||||
|
||||
if ( !isset($c->enable_autodiscover) || ! $c->enable_autodiscover ) {
|
||||
$request->DoResponse( 404 );
|
||||
exit(0);
|
||||
exit(0); // unneccessary
|
||||
}
|
||||
|
||||
$ns_outlook_req_2006 = "http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006";
|
||||
@ -40,7 +40,7 @@ function errorResponse( $code, $message, $debugdata = '' ) {
|
||||
ERROR;
|
||||
|
||||
$request->DoResponse( $code, $response, 'text/xml; charset="utf-8"' );
|
||||
exit(0);
|
||||
exit(0); // unneccessary
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -353,6 +353,5 @@ if ( $qry->Commit() ) {
|
||||
* Or it was all crap.
|
||||
*/
|
||||
$request->DoResponse( 500 );
|
||||
|
||||
exit(0);
|
||||
exit(0); // unneccessary
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ switch ( $request->path ) {
|
||||
if ( $c->enable_scheduling != true )
|
||||
{
|
||||
$request->DoResponse( 404, translate('The application program does not understand that request.') );
|
||||
exit ();
|
||||
// Does not return
|
||||
}
|
||||
|
||||
header ( 'iSchedule-Version: 1.0' );
|
||||
@ -103,5 +103,6 @@ RESPONSE;
|
||||
</capability-set>
|
||||
</query-result>
|
||||
RESPONSE;
|
||||
exit ( 0 );
|
||||
|
||||
@ob_flush(); exit(0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user