diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index e70b8e8d00..85ee141df8 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -813,9 +813,8 @@ class calendar_groupdav extends groupdav_handler { $this->groupdav->log(__METHOD__."(,,$user) schedule-tag given, but NO changes for current user events=".array2string($events).', old-event='.array2string($oldEvent)); } - // we should not return an etag here, as we never store the PUT ical byte-by-byte - //header('ETag: "'.$etag.'"'); - header('Schedule-Tag: "'.$schedule_tag.'"'); + $this->put_response_headers($eventId, $options['path'], '204 No Content', self::$path_attr == 'caldav_name'); + return '204 No Content'; } if ($this->debug && !isset($events)) error_log(__METHOD__."(,,$user) only schedule-tag given for event without participants (only calendar owner) --> handle as regular PUT"); @@ -867,14 +866,6 @@ class calendar_groupdav extends groupdav_handler } } - if ($this->use_schedule_tag) - { - $etag = $this->get_etag($cal_id, $schedule_tag); - // we should not return an etag here, as we never store the PUT ical byte-by-byte - //header('ETag: "'.$etag.'"'); - header('Schedule-Tag: "'.$schedule_tag.'"'); - } - // send evtl. necessary respose headers: Location, etag, ... $this->put_response_headers($cal_id, $options['path'], $retval, self::$path_attr == 'caldav_name'); @@ -1315,6 +1306,27 @@ class calendar_groupdav extends groupdav_handler return $etag; } + /** + * Send response-headers for a PUT (or POST with add-member query parameter) + * + * Reimplemented to send + * + * @param int|array $entry id or array of new created entry + * @param string $path + * @param int|string $retval + * @param boolean $path_attr_is_name=true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header) + */ + function put_response_headers($entry, $path, $retval, $path_attr_is_name=true) + { + $etag = $this->get_etag($entry, $schedule_tag); + + if ($this->use_schedule_tag) + { + header('Schedule-Tag: "'.$schedule_tag.'"'); + } + parent::put_response_headers($entry, $path, $retval, $path_attr_is_name, $etag); + } + /** * Check if user has the neccessary rights on an event * diff --git a/phpgwapi/inc/class.groupdav.inc.php b/phpgwapi/inc/class.groupdav.inc.php index 17b574b052..739e1397d5 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -1003,6 +1003,7 @@ class groupdav extends HTTP_WebDAV_Server 'DAV:displayname' => 'Displayname', 'DAV:getlastmodified' => 'Last modified', 'DAV:getetag' => 'ETag', + //'CalDAV:schedule-tag' => 'Schedule-Tag', 'DAV:getcontenttype' => 'Content type', 'DAV:resourcetype' => 'Resource type', //'http://calendarserver.org/ns/:created-by' => 'Created by', diff --git a/phpgwapi/inc/class.groupdav_handler.inc.php b/phpgwapi/inc/class.groupdav_handler.inc.php index 43fbe6e87b..2f1094a8ed 100644 --- a/phpgwapi/inc/class.groupdav_handler.inc.php +++ b/phpgwapi/inc/class.groupdav_handler.inc.php @@ -474,18 +474,20 @@ abstract class groupdav_handler * @param string $path * @param int|string $retval * @param boolean $path_attr_is_name=true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header) + * @param string $etag=null etag, to not calculate it again (if != null) */ - function put_response_headers($entry, $path, $retval, $path_attr_is_name=true) + function put_response_headers($entry, $path, $retval, $path_attr_is_name=true, $etag=null) { // we should not return an etag here, as EGroupware never stores ical/vcard byte-by-byte // as SOGO Connector requires ETag header to recognice as successful PUT, we are sending them again for it // --> as all clients dislike not getting an ETag for a PUT, we sending it again even not storing byte-by-byte //if (get_class($this) == 'addressbook_groupdav' && in_array(self::get_agent(),array('thunderbird','lightning'))) { - header('ETag: "'.$this->get_etag($entry).'"'); + if (is_null($etag)) $etag = $this->get_etag($entry); + header('ETag: "'.$etag.'"'); } - // send Location header only if we dont use caldav_name as path-attribute or - if ($retval !== true && (!$path_attr_is_name || + // send Location header only on success AND if we dont use caldav_name as path-attribute or + if (!(is_bool($retval) ? $retval : $retval[0] === '2') && (!$path_attr_is_name || // POST with add-member query parameter $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['add-member']))) {