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];
51 wprintf("HTTP/1.1 401 Unauthorized\n");
52 groupdav_common_headers();
53 wprintf("WWW-Authenticate: Basic realm=\"%s\"\n", serv_info.serv_humannode);
54 wprintf("Content-Type: text/plain\n");
56 wprintf("GroupDAV sessions require HTTP authentication.\n");
60 extract_token(dav_method, req->line, 0, ' ');
61 extract_token(dav_pathname, req->line, 1, ' ');
62 unescape_input(dav_pathname);
65 * We like the GET method ... it's nice and simple.
67 if (!strcasecmp(dav_method, "GET")) {
68 groupdav_get(dav_pathname);
73 * Couldn't find what we were looking for. Die in a car fire.
75 wprintf("HTTP/1.1 501 Method not implemented\n");
76 groupdav_common_headers();
77 wprintf("Content-Type: text/plain\n"
79 "GroupDAV method \"%s\" is not implemented.\n",
84 * FIXME ... after development is finished, get rid of all this
86 wprintf("\n\n\n ** DEBUGGING INFO FOLLOWS ** \n\n");
87 wprintf("WC->httpauth_user = %s\n", WC->httpauth_user);
88 wprintf("WC->httpauth_pass = (%d characters)\n", strlen(WC->httpauth_pass));
89 wprintf("WC->wc_session = %d\n", WC->wc_session);
91 for (rptr=req; rptr!=NULL; rptr=rptr->next) {
92 wprintf("> %s\n", rptr->line);