summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kolab/CardDAV/Plugin.php18
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)