Add a configuration option to use the older 'sync-response' tag.

When the WebDAV sync draft first came out the responses were each
contained in a DAV::sync-response tag, but by -03 this has changed
to a DAV::response tag since the format of the tag contents now
match this existing tag structure.

Unfortunately some client software in the wild depends on this
being a DAV::sync-response so the config option is needed to
interoperate with this software.
This commit is contained in:
Andrew McMillan 2010-09-25 17:18:54 +12:00
parent 1e22e9a8a1
commit b80dd10c7b
3 changed files with 31 additions and 5 deletions

View File

@ -46,9 +46,10 @@ $new_token = $row->new_sync_token;
if ( $sync_token == 0 ) {
$sql = <<<EOSQL
SELECT *, 201 AS sync_status FROM collection
SELECT collection.*, calendar_item.*, caldav_data.*, addressbook_resource.*, 201 AS sync_status FROM collection
LEFT JOIN caldav_data USING (collection_id)
LEFT JOIN calendar_item USING (dav_id)
LEFT JOIN addressbook_resource USING (dav_id)
WHERE collection.collection_id = :collection_id
ORDER BY collection.collection_id, caldav_data.dav_id
EOSQL;
@ -111,7 +112,9 @@ if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) {
$dav_resource = new DAVResource($object);
$resultset = array_merge( $resultset, $dav_resource->GetPropStat($proplist,$reply) );
}
$responses[] = new XMLElement( 'response', $resultset );
$response_tag = 'response';
if ( isset($c->use_old_sync_response_tag) && $c->use_old_sync_response_tag ) $response_tag = 'sync-response';
$responses[] = new XMLElement( $response_tag, $resultset );
$first_status = $object->sync_status;
$last_dav_name = $object->dav_name;
}

View File

@ -2,11 +2,33 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook
ETag: "4f90eca1c5db8d18e5711adc09651e60"
Content-Length: 110
ETag: "c02e623cc20b07f8f102bdd60d49ff6a"
Content-Length: 747
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/caldav.php/user1/addressbook/andrew_mcmillan.vcf</href>
<status>HTTP/1.1 201 Created</status>
<propstat>
<prop>
<getetag>"24bae2a7f81c0a79413a656c06d8326b"</getetag>
<getcontenttype>text/vcard</getcontenttype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/donald_kelly.vcf</href>
<status>HTTP/1.1 201 Created</status>
<propstat>
<prop>
<getetag>"fada70a725708bce8521efb87acfa629"</getetag>
<getcontenttype>text/vcard</getcontenttype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<sync-token>5</sync-token>
</multistatus>

View File

@ -13,6 +13,7 @@ BEGINDATA
<D:sync-token/>
<D:prop>
<D:getetag/>
<D:getcontenttype/>
</D:prop>
</D:sync-collection>
ENDDATA