Prevent nginx from buffering event source events

This commit is contained in:
Robin Appelman 2014-07-26 15:50:11 +02:00
parent 40f2a34be1
commit 2c4e06d325
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ class OC_EventSource{
public function __construct() { public function __construct() {
OC_Util::obEnd(); OC_Util::obEnd();
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
header('X-Accel-Buffering: no');
$this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true'; $this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true';
if($this->fallback) { if($this->fallback) {
$this->fallBackId=$_GET['fallback_id']; $this->fallBackId=$_GET['fallback_id'];
@ -44,6 +45,7 @@ class OC_EventSource{
} }
if( !OC_Util::isCallRegistered()) { if( !OC_Util::isCallRegistered()) {
$this->send('error', 'Possible CSRF attack. Connection will be closed.'); $this->send('error', 'Possible CSRF attack. Connection will be closed.');
$this->close();
exit(); exit();
} }
flush(); flush();