4 * Handles DAV OPTIONS requests (experimental -- not required by GroupDAV)
13 * The pathname is always going to be /groupdav/room_name/msg_num
15 void groupdav_options(char *dav_pathname) {
16 char dav_roomname[256];
18 long dav_msgnum = (-1);
23 http_datestring(datestring, sizeof datestring, now);
25 extract_token(dav_roomname, dav_pathname, 2, '/', sizeof dav_roomname);
26 extract_token(dav_uid, dav_pathname, 3, '/', sizeof dav_uid);
29 * If the room name is blank, the client is doing a top-level OPTIONS.
31 if (strlen(dav_roomname) == 0) {
32 wprintf("HTTP/1.1 200 OK\r\n");
33 groupdav_common_headers();
34 wprintf("Date: %s\r\n", datestring);
35 wprintf("Allow: OPTIONS, PROPFIND\r\n");
40 /* Go to the correct room. */
41 if (strcasecmp(WC->wc_roomname, dav_roomname)) {
42 gotoroom(dav_roomname);
44 if (strcasecmp(WC->wc_roomname, dav_roomname)) {
45 wprintf("HTTP/1.1 404 not found\r\n");
46 groupdav_common_headers();
47 wprintf("Date: %s\r\n", datestring);
49 "Content-Type: text/plain\r\n"
51 "There is no folder called \"%s\" on this server.\r\n",
57 /* If dav_uid is non-empty, client is requesting an OPTIONS on
58 * a specific item in the room.
60 if (strlen(dav_uid) > 0) {
62 dav_msgnum = locate_message_by_uid(dav_uid);
64 wprintf("HTTP/1.1 404 not found\r\n");
65 groupdav_common_headers();
67 "Content-Type: text/plain\r\n"
69 "Object \"%s\" was not found in the \"%s\" folder.\r\n",
76 wprintf("HTTP/1.1 200 OK\r\n");
77 groupdav_common_headers();
78 wprintf("Date: %s\r\n", datestring);
79 wprintf("Allow: OPTIONS, PROPFIND, GET, PUT, DELETE\r\n");
86 * We got to this point, which means that the client is requesting
87 * an OPTIONS on the room itself.
89 wprintf("HTTP/1.1 200 OK\r\n");
90 groupdav_common_headers();
91 wprintf("Date: %s\r\n", datestring);
92 wprintf("Allow: OPTIONS, PROPFIND, GET, PUT\r\n");