4 * Entry point for GroupDAV functions
14 #include <sys/types.h>
16 #include <sys/socket.h>
25 #include "webserver.h"
30 * Output HTTP headers which are common to all requests.
32 void groupdav_common_headers(void) {
35 "Connection: close\n",
36 SERVER, serv_info.serv_software
42 * Main entry point for GroupDAV requests
44 void groupdav_main(struct httprequest *req) {
46 struct httprequest *rptr;
48 char dav_pathname[SIZ];
50 for (rptr=req; rptr!=NULL; rptr=rptr->next) {
51 lprintf(9, "> %s\n", rptr->line);
55 wprintf("HTTP/1.1 401 Unauthorized\n");
56 groupdav_common_headers();
57 wprintf("WWW-Authenticate: Basic realm=\"%s\"\n", serv_info.serv_humannode);
58 wprintf("Content-Type: text/plain\n");
60 wprintf("GroupDAV sessions require HTTP authentication.\n");
64 extract_token(dav_method, req->line, 0, ' ');
65 extract_token(dav_pathname, req->line, 1, ' ');
66 unescape_input(dav_pathname);
69 * We like the GET method ... it's nice and simple.
71 if (!strcasecmp(dav_method, "GET")) {
72 groupdav_get(dav_pathname);
77 * The PROPFIND method is basically used to list all objects in a room.
79 if (!strcasecmp(dav_method, "PROPFIND")) {
80 groupdav_propfind(dav_pathname);
85 * Couldn't find what we were looking for. Die in a car fire.
87 wprintf("HTTP/1.1 501 Method not implemented\n");
88 groupdav_common_headers();
89 wprintf("Content-Type: text/plain\n"
91 "GroupDAV method \"%s\" is not implemented.\n",