4 * Handles GroupDAV GET requests.
14 * The pathname is always going to be /groupdav/room_name/euid
16 void groupdav_get(char *dav_pathname) {
17 char dav_roomname[SIZ];
19 long dav_msgnum = (-1);
23 int found_content_type = 0;
25 /* First, break off the "/groupdav/" prefix */
26 remove_token(dav_pathname, 0, '/');
27 remove_token(dav_pathname, 0, '/');
29 /* Now extract the message euid */
30 n = num_tokens(dav_pathname, '/');
31 extract_token(dav_uid, dav_pathname, n-1, '/', sizeof dav_uid);
32 remove_token(dav_pathname, n-1, '/');
34 /* What's left is the room name. Remove trailing slashes. */
35 if (dav_pathname[strlen(dav_pathname)-1] == '/') {
36 dav_pathname[strlen(dav_pathname)-1] = 0;
38 strcpy(dav_roomname, dav_pathname);
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();
48 "Content-Type: text/plain\r\n"
50 "There is no folder called \"%s\" on this server.\r\n",
56 dav_msgnum = locate_message_by_uid(dav_uid);
57 serv_printf("MSG2 %ld", dav_msgnum);
58 serv_getln(buf, sizeof buf);
60 wprintf("HTTP/1.1 404 not found\r\n");
61 groupdav_common_headers();
63 "Content-Type: text/plain\r\n"
65 "Object \"%s\" was not found in the \"%s\" folder.\r\n",
72 wprintf("HTTP/1.1 200 OK\r\n");
73 groupdav_common_headers();
74 wprintf("etag: \"%ld\"\r\n", dav_msgnum);
75 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
76 if (!strncasecmp(buf, "Date: ", 6)) {
77 wprintf("%s\r\n", buf);
79 if (!strncasecmp(buf, "Content-type: ", 14)) {
80 wprintf("%s\r\n", buf);
81 found_content_type = 1;
83 if ((strlen(buf) == 0) && (in_body == 0)) {
84 if (!found_content_type) {
85 wprintf("Content-type: text/plain\r\n");
90 wprintf("%s\r\n", buf);