DAV: getcontenttype tag belongs inside prop tag (thanks bravegnu)
authorArt Cancro <ajc@citadel.org>
Mon, 30 Oct 2017 18:47:54 +0000 (14:47 -0400)
committerArt Cancro <ajc@citadel.org>
Mon, 30 Oct 2017 18:47:54 +0000 (14:47 -0400)
webcit-ng/room_functions.c
webcit/dav_propfind.c

index 9db3e7978af4899dd3c07c193dd877fb7b2c133d..4d166e320310d490739cff37a110b9bd555bc223 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Room functions
  *
- * Copyright (c) 1996-2016 by the citadel.org team
+ * Copyright (c) 1996-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -358,6 +358,9 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                StrBufAppendPrintf(Buf, "/");
                                StrBufXMLEscAppend(Buf, NULL, e, strlen(e), 0);
                                StrBufAppendPrintf(Buf, "</D:href>");
+                               StrBufAppendPrintf(Buf, "<D:propstat>");
+                               StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
+                               StrBufAppendPrintf(Buf, "<D:prop>");
 
                                switch(c->room_default_view) {
                                        case VIEW_CALENDAR:
@@ -371,9 +374,6 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                                break;
                                }
 
-                               StrBufAppendPrintf(Buf, "<D:propstat>");
-                               StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
-                               StrBufAppendPrintf(Buf, "<D:prop>");
                                if (timestamp > 0) {
                                        char *datestring = http_datestring(timestamp);
                                        if (datestring) {
@@ -382,7 +382,7 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                                StrBufAppendPrintf(Buf, "</D:getlastmodified>");
                                                free(datestring);
                                        }
-                                       if (enumerate_by_euid) {
+                                       if (enumerate_by_euid) {                // FIXME ajc 2017oct30 should this really be inside the timestamp conditional?
                                                StrBufAppendPrintf(Buf, "<D:getetag>\"%ld\"</D:getetag>", msglist[i]);
                                        }
                                }
index 3df13423e6cb13a9bd55784ea2247b547e63c565..b3a848a9ddf80cbb2e0cb1abd002eb14aadadd03 100644 (file)
  * References:
  * http://www.ietf.org/rfc/rfc4791.txt
  * http://blogs.nologin.es/rickyepoderi/index.php?/archives/14-Introducing-CalDAV-Part-I.html
-
-Sample query:
-
-PROPFIND /groupdav/calendar/ HTTP/1.1
-Content-type: text/xml; charset=utf-8
-Content-length: 166
-
-<?xml version="1.0" encoding="UTF-8"?>
-<D:propfind xmlns:D="DAV:">
-  <D:prop>
-    <D:getcontenttype/>
-    <D:resourcetype/>
-    <D:getetag/>
-  </D:prop>
-</D:propfind>
-
+ * https://msdn.microsoft.com/en-us/library/aa142960(v=exchg.65).aspx
  *
- * Copyright (c) 2005-2012 by the citadel.org team
+ * Copyright (c) 2005-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 3.
@@ -725,14 +710,18 @@ void dav_propfind(void)
        
                        if (!IsEmptyStr(uid)) {
                                wc_printf("<D:response>");
-                                       wc_printf("<D:href>");
-                                               dav_identify_host();
-                                               wc_printf("/groupdav/");
-                                               urlescputs(ChrPtr(WCC->CurRoom.name));
-                                               euid_escapize(encoded_uid, uid);
-                                               wc_printf("/%s", encoded_uid);
-                                       wc_printf("</D:href>");
-                                       switch(WCC->CurRoom.defview) {
+                               wc_printf("<D:href>");
+                               dav_identify_host();
+                               wc_printf("/groupdav/");
+                               urlescputs(ChrPtr(WCC->CurRoom.name));
+                               euid_escapize(encoded_uid, uid);
+                               wc_printf("/%s", encoded_uid);
+                               wc_printf("</D:href>");
+                               wc_printf("<D:propstat>");
+                               wc_printf("<D:status>HTTP/1.1 200 OK</D:status>");
+                               wc_printf("<D:prop>");
+                               wc_printf("<D:getetag>\"%ld\"</D:getetag>", msgs[i]);
+                               switch(WCC->CurRoom.defview) {
                                        case VIEW_CALENDAR:
                                                wc_printf("<D:getcontenttype>text/x-ical</D:getcontenttype>");
                                                break;
@@ -742,19 +731,15 @@ void dav_propfind(void)
                                        case VIEW_ADDRESSBOOK:
                                                wc_printf("<D:getcontenttype>text/x-vcard</D:getcontenttype>");
                                                break;
-                                       }
-                                       wc_printf("<D:propstat>");
-                                               wc_printf("<D:status>HTTP/1.1 200 OK</D:status>");
-                                               wc_printf("<D:prop>");
-                                                       wc_printf("<D:getetag>\"%ld\"</D:getetag>", msgs[i]);
-                                               if (now > 0L) {
-                                                       http_datestring(datestring, sizeof datestring, now);
-                                                       wc_printf("<D:getlastmodified>");
-                                                       escputs(datestring);
-                                                       wc_printf("</D:getlastmodified>");
-                                               }
-                                               wc_printf("</D:prop>");
-                                       wc_printf("</D:propstat>");
+                               }
+                               if (now > 0L) {
+                                       http_datestring(datestring, sizeof datestring, now);
+                                       wc_printf("<D:getlastmodified>");
+                                       escputs(datestring);
+                                       wc_printf("</D:getlastmodified>");
+                               }
+                               wc_printf("</D:prop>");
+                               wc_printf("</D:propstat>");
                                wc_printf("</D:response>");
                        }
                }
@@ -831,9 +816,9 @@ InitModule_PROPFIND
                eReadEUIDS,
                DavUIDL_GetParamsGetServerCall,
                NULL,
-               NULL, /// TODO: is this right?
+               NULL,
                ParseMessageListHeaders_EUID,
-               NULL, //// ""
+               NULL,
                DavUIDL_RenderView_or_Tail,
                DavUIDL_Cleanup,
                NULL);