diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2013-11-25 13:43:17 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2013-11-25 13:45:19 (GMT) |
commit | 999b2b460b1e38a6f01da97fbc6da2c3afd2ddde (patch) | |
tree | f1facfd3604d268a0530c5fb6025a3fa20cf2807 /lib/Kolab | |
parent | ab270d101a306710a401b520932f537969100e9d (diff) | |
download | iRony-999b2b460b1e38a6f01da97fbc6da2c3afd2ddde.tar.gz |
Ignore If-None-Match: * headers from buggy SOGo connector (#2589)iRony-0.2.5
Diffstat (limited to 'lib/Kolab')
-rw-r--r-- | lib/Kolab/CardDAV/Plugin.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Kolab/CardDAV/Plugin.php b/lib/Kolab/CardDAV/Plugin.php index 3d7aa7d..2abf0a8 100644 --- a/lib/Kolab/CardDAV/Plugin.php +++ b/lib/Kolab/CardDAV/Plugin.php @@ -49,11 +49,29 @@ class Plugin extends CardDAV\Plugin { parent::initialize($server); + $server->subscribeEvent('beforeMethod', array($this, 'beforeMethod')); $server->subscribeEvent('afterCreateFile', array($this, 'afterWriteContent')); $server->subscribeEvent('afterWriteContent', array($this, 'afterWriteContent')); } /** + * Handler for beforeMethod events + */ + public function beforeMethod($method, $uri) + { + if ($method == 'PUT' && $this->server->httpRequest->getHeader('If-None-Match') == '*') { + // In-None-Match: * is only valid with PUT requests creating a new resource. + // SOGo Conenctor for Thunderbird also sends it with update requests which then fail + // in the Server::checkPreconditions(). + // See https://issues.kolab.org/show_bug.cgi?id=2589 and http://www.sogo.nu/bugs/view.php?id=1624 + // This is a work-around for the buggy SOGo connector and should be removed once fixed. + if (strpos($this->server->httpRequest->getHeader('User-Agent'), 'Thunderbird/') > 0) { + unset($_SERVER['HTTP_IF_NONE_MATCH']); + } + } + } + + /** * Inject some additional HTTP response headers */ public function afterWriteContent($uri, $node) |