]> code.citadel.org Git - citadel.git/blobdiff - webcit/groupdav_options.c
* add logging if auth-basic session connecting fails with weird conditions
[citadel.git] / webcit / groupdav_options.c
index 5f678c1e647b6e2485f44d8ad51ef276c2f0bab7..e20d1a07fbda65430a74c207f53979fe27766df5 100644 (file)
@@ -12,7 +12,9 @@
 /*
  * The pathname is always going to be /groupdav/room_name/msg_num
  */
-void groupdav_options(StrBuf *dav_pathname) {
+void groupdav_options(void)
+{
+       wcsession *WCC = WC;
        StrBuf *dav_roomname;
        StrBuf *dav_uid;
        long dav_msgnum = (-1);
@@ -24,8 +26,8 @@ void groupdav_options(StrBuf *dav_pathname) {
 
        dav_roomname = NewStrBuf();
        dav_uid = NewStrBuf();
-       StrBufExtract_token(dav_roomname, dav_pathname, 2, '/');
-       StrBufExtract_token(dav_uid, dav_pathname, 3, '/');
+       StrBufExtract_token(dav_roomname, WCC->Hdr->HR.ReqLine, 0, '/');
+       StrBufExtract_token(dav_uid, WCC->Hdr->HR.ReqLine, 1, '/');
 
        /*
         * If the room name is blank, the client is doing a top-level OPTIONS.
@@ -54,12 +56,12 @@ void groupdav_options(StrBuf *dav_pathname) {
                groupdav_common_headers();
                hprintf("Date: %s\r\n", datestring);
                hprintf(
-                       "Content-Type: text/plain\r\n"
-                       "\r\n"
+                       "Content-Type: text/plain\r\n");
+               begin_burst();
+               wprintf(
                        "There is no folder called \"%s\" on this server.\r\n",
                        ChrPtr(dav_roomname)
                );
-               begin_burst();
                end_burst();
                FreeStrBuf(&dav_roomname);
                FreeStrBuf(&dav_uid);
@@ -75,16 +77,16 @@ void groupdav_options(StrBuf *dav_pathname) {
                if (dav_msgnum < 0) {
                        hprintf("HTTP/1.1 404 not found\r\n");
                        groupdav_common_headers();
-                       hprintf(
-                               "Content-Type: text/plain\r\n"
-                               "\r\n"
+                       hprintf("Content-Type: text/plain\r\n");
+                       begin_burst();
+                       wprintf(
                                "Object \"%s\" was not found in the \"%s\" folder.\r\n",
                                ChrPtr(dav_uid),
                                ChrPtr(dav_roomname)
                        );
                        FreeStrBuf(&dav_roomname);
                        FreeStrBuf(&dav_uid);
-                       begin_burst();end_burst();return;
+                       end_burst();return;
                }
 
                hprintf("HTTP/1.1 200 OK\r\n");
@@ -92,7 +94,7 @@ void groupdav_options(StrBuf *dav_pathname) {
                hprintf("Date: %s\r\n", datestring);
                hprintf("DAV: 1\r\n");
                hprintf("Allow: OPTIONS, PROPFIND, GET, PUT, DELETE\r\n");
-               hprintf("\r\n");
+               
                begin_burst();
                end_burst();
                FreeStrBuf(&dav_roomname);
@@ -112,7 +114,7 @@ void groupdav_options(StrBuf *dav_pathname) {
        hprintf("Date: %s\r\n", datestring);
        hprintf("DAV: 1\r\n");
        hprintf("Allow: OPTIONS, PROPFIND, GET, PUT\r\n");
-       hprintf("\r\n");
        begin_burst();
+       wprintf("\r\n");
        end_burst();
 }