From ef68475c0e7277dc37c606955d92566fb6d56b1a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 11 Sep 2008 10:24:25 +1200 Subject: [PATCH 1/4] Quanta droppings. --- davical.webprj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/davical.webprj b/davical.webprj index d75e46a6..0c4ca9b6 100644 --- a/davical.webprj +++ b/davical.webprj @@ -265,6 +265,6 @@ - + From 21d8f5129e3cbb805485a5b0394c6c3fbe025a0a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 11 Sep 2008 10:24:46 +1200 Subject: [PATCH 2/4] Allow DAV: header to be overridden more tidily for development. --- htdocs/caldav.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/caldav.php b/htdocs/caldav.php index a8a1a73b..f81eebf2 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -22,9 +22,13 @@ $session = new HTTPAuthSession(); * access-control is rfc3744, so we will say we do it, but I doubt if we do it * in all (or even much of) it's glory really. */ -$dav = "1, 2, access-control, calendar-access"; +if ( isset($c->override_dav_header) ) { + $dav = $c->override_dav_header; +} +else { + $dav = "1, 2, access-control, calendar-access"; +} header( "DAV: $dav"); -// header( "DAV: 1, 2, access-control, calendar-access, calendar-schedule"); require_once("CalDAVRequest.php"); $request = new CalDAVRequest(); From 5a9a86df522d8cefb9878a008f0eb89de76f068e Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 11 Sep 2008 10:26:07 +1200 Subject: [PATCH 3/4] Add basic support for Calendar Server getctag extension --- inc/caldav-PROPFIND.php | 17 +++++++++++++---- .../regression-suite/503-iCal-PROPFIND.result | 10 +++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 72e4b808..50aac4f4 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -117,6 +117,12 @@ function namespace_array() { } +function calendar_server_tag( $tag ) { + add_namespace("A", "http://calendarserver.org/ns/"); + return ns_tag( $tag, 'http://calendarserver.org/ns/' ); +} + + function caldav_tag( $tag ) { return ns_tag( $tag, 'urn:ietf:params:xml:ns:caldav' ); } @@ -158,6 +164,7 @@ foreach( $request->xml_tags AS $k => $v ) { case 'GETCONTENTLENGTH': /** getcontentlength- should work fine */ case 'GETCONTENTTYPE': /** getcontenttype - should work fine */ case 'GETETAG': /** getetag - should work fine */ + case 'GETCTAG': /** Calendar Server extension like etag - should work fine (we just return etag) */ case 'SUPPORTEDLOCK': /** supportedlock - should work fine */ case 'PRINCIPAL-URL': /** principal-url - should work fine */ case 'RESOURCETYPE': /** resourcetype - should work fine */ @@ -291,12 +298,10 @@ function add_principal_properties( &$prop, &$not_found, &$denied ) { } if ( isset($attribute_list['DROPBOX-HOME-URL'] ) ) { - add_namespace("A", "http://calendarserver.org/ns/"); - $prop->NewElement("A:dropbox-home-url", new XMLElement('href', $request->principal->dropbox_url) ); + $prop->NewElement(calendar_server_tag("dropbox-home-url"), new XMLElement('href', $request->principal->dropbox_url) ); } if ( isset($attribute_list['NOTIFICATIONS-URL'] ) ) { - add_namespace("A", "http://calendarserver.org/ns/"); - $prop->NewElement("A:notifications-url", new XMLElement('href', $request->principal->notifications_url) ); + $prop->NewElement(calendar_server_tag("notifications-url"), new XMLElement('href', $request->principal->notifications_url) ); } if ( isset($attribute_list['CALENDAR-USER-ADDRESS-SET'] ) ) { @@ -379,6 +384,10 @@ function collection_to_xml( $collection ) { if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['GETETAG']) ) { $prop->NewElement("getetag", '"'.$collection->dav_etag.'"' ); } + if ( isset($attribute_list['GETCTAG']) ) { + // Calendar Server extension which only applies to collections. We return the etag, which does the needful. + $prop->NewElement(calendar_server_tag('getctag'),$collection->dav_etag ); + } if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['CURRENT-USER-PRIVILEGE-SET']) ) { $prop->NewElement("current-user-privilege-set", privileges($request->permissions) ); } diff --git a/testing/tests/regression-suite/503-iCal-PROPFIND.result b/testing/tests/regression-suite/503-iCal-PROPFIND.result index 3cc4b197..f07aa16f 100644 --- a/testing/tests/regression-suite/503-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/503-iCal-PROPFIND.result @@ -1,12 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "45e62f9b3b6b55ac40673d4ef35948b9" -Content-Length: 623 +ETag: "f5bcdac4101184e674bfb4112dfe4b0c" +Content-Length: 666 Content-Type: text/xml; charset="utf-8" - + /caldav.php/user1/home/ @@ -16,13 +16,13 @@ Content-Type: text/xml; charset="utf-8" home + faf25336de0e470a54075c14cbcf5272 HTTP/1.1 200 OK - - + HTTP/1.1 404 Not Found From 4b6eedea6f482a27fec4598c6e439fbabb2d47d8 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 15 Sep 2008 19:15:53 +1200 Subject: [PATCH 4/4] Note TODO item. --- inc/caldav-REPORT-multiget.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/caldav-REPORT-multiget.php b/inc/caldav-REPORT-multiget.php index 516fda59..44ca771c 100644 --- a/inc/caldav-REPORT-multiget.php +++ b/inc/caldav-REPORT-multiget.php @@ -1,5 +1,9 @@