From b80dd10c7bae6e38064f8670234cc5d12d806d73 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 25 Sep 2010 17:18:54 +1200 Subject: [PATCH] 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. --- inc/caldav-REPORT-sync-collection.php | 9 ++++--- .../carddav/2010-REPORT-sync-initial.result | 26 +++++++++++++++++-- .../carddav/2010-REPORT-sync-initial.test | 1 + 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php index b58af699..3a7da1fa 100644 --- a/inc/caldav-REPORT-sync-collection.php +++ b/inc/caldav-REPORT-sync-collection.php @@ -46,10 +46,11 @@ $new_token = $row->new_sync_token; if ( $sync_token == 0 ) { $sql = <<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; } diff --git a/testing/tests/carddav/2010-REPORT-sync-initial.result b/testing/tests/carddav/2010-REPORT-sync-initial.result index 4a306b58..881dc2ae 100644 --- a/testing/tests/carddav/2010-REPORT-sync-initial.result +++ b/testing/tests/carddav/2010-REPORT-sync-initial.result @@ -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" + + /caldav.php/user1/addressbook/andrew_mcmillan.vcf + HTTP/1.1 201 Created + + + "24bae2a7f81c0a79413a656c06d8326b" + text/vcard + + HTTP/1.1 200 OK + + + + /caldav.php/user1/addressbook/donald_kelly.vcf + HTTP/1.1 201 Created + + + "fada70a725708bce8521efb87acfa629" + text/vcard + + HTTP/1.1 200 OK + + 5 diff --git a/testing/tests/carddav/2010-REPORT-sync-initial.test b/testing/tests/carddav/2010-REPORT-sync-initial.test index fa35aebf..95b70392 100644 --- a/testing/tests/carddav/2010-REPORT-sync-initial.test +++ b/testing/tests/carddav/2010-REPORT-sync-initial.test @@ -13,6 +13,7 @@ BEGINDATA + ENDDATA