diff options
Diffstat (limited to 'lib/private/legacy/OC_EventSource.php')
-rw-r--r-- | lib/private/legacy/OC_EventSource.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/legacy/OC_EventSource.php b/lib/private/legacy/OC_EventSource.php index c733316050f..cd72ba1f2d5 100644 --- a/lib/private/legacy/OC_EventSource.php +++ b/lib/private/legacy/OC_EventSource.php @@ -1,4 +1,7 @@ <?php + +use OCP\IRequest; + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -42,6 +45,12 @@ class OC_EventSource implements \OCP\IEventSource { */ private $started = false; + private IRequest $request; + + public function __construct(IRequest $request) { + $this->request = $request; + } + protected function init() { if ($this->started) { return; @@ -71,11 +80,11 @@ class OC_EventSource implements \OCP\IEventSource { } else { header("Content-Type: text/event-stream"); } - if (!\OC::$server->getRequest()->passesStrictCookieCheck()) { + if (!$this->request->passesStrictCookieCheck()) { header('Location: '.\OC::$WEBROOT); exit(); } - if (!\OC::$server->getRequest()->passesCSRFCheck()) { + if (!$this->request->passesCSRFCheck()) { $this->send('error', 'Possible CSRF attack. Connection will be closed.'); $this->close(); exit(); |