4 * Handles GroupDAV GET requests.
14 #include <sys/types.h>
16 #include <sys/socket.h>
25 #include "webserver.h"
30 * The pathname is always going to be /groupdav/room_name/msg_num
32 void groupdav_get(char *dav_pathname) {
33 char dav_roomname[SIZ];
36 int found_content_type = 0;
38 extract_token(dav_roomname, dav_pathname, 2, '/');
39 extract_token(dav_msgnum, dav_pathname, 3, '/');
41 /* Go to the correct room. */
42 if (strcasecmp(WC->wc_roomname, dav_roomname)) {
43 gotoroom(dav_roomname);
45 if (strcasecmp(WC->wc_roomname, dav_roomname)) {
47 "HTTP/1.1 404 not found\n"
49 "Content-Type: text/plain\n"
51 "There is no folder called \"%s\" on this server.\n",
57 serv_printf("MSG2 %s", dav_msgnum);
61 "HTTP/1.1 404 not found\n"
63 "Content-Type: text/plain\n"
65 "Object \"%s\" was not found in the \"%s\" folder.\n",
72 wprintf("HTTP/1.1 200 OK\n");
73 wprintf("ETag: %s\n", dav_msgnum);
74 while (serv_gets(buf), strcmp(buf, "000")) {
75 if (!strncasecmp(buf, "Content-type: ", 14)) {
76 found_content_type = 1;
78 if ((strlen(buf) == 0) && (found_content_type == 0)) {
79 wprintf("Content-type: text/plain\n");