From a29968a6cdb57383bf9f38b71486c6b00734e7f2 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 5 Feb 2012 09:45:00 -0800 Subject: [PATCH] Detect unsupported sync-level and return specified error. This covers the -08 of the webdav synchronisation draft. --- inc/caldav-REPORT-sync-collection.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php index 34de6302..d8f0651c 100644 --- a/inc/caldav-REPORT-sync-collection.php +++ b/inc/caldav-REPORT-sync-collection.php @@ -14,6 +14,22 @@ $responses = array(); /** * Build the array of properties to include in the report output */ +$sync_level = $xmltree->GetPath('/DAV::sync-collection/DAV::sync-level'); +if ( empty($sync_level) ) { + $sync_level = $request->depth; +} +else { + $sync_level = $sync_level[0]->GetContent(); + if ( $sync_level == 'infinity' ) + $sync_level = DEPTH_INFINITY; + else + $sync_level = 1; +} + +if ( $sync_level == DEPTH_INFINITY ) { + $request->PreconditionFailed(403, 'DAV::sync-traversal-supported','This server does not support sync-traversal'); +} + $sync_tokens = $xmltree->GetPath('/DAV::sync-collection/DAV::sync-token'); $sync_token = $sync_tokens[0]->GetContent(); if ( !isset($sync_token) ) $sync_token = 0;