]> code.citadel.org Git - citadel.git/blobdiff - webcit/groupdav_main.c
* Implemented the Groupdav GET method, more or less in its final form
[citadel.git] / webcit / groupdav_main.c
index 81987514dcf97b1a025de38b407f046ed252a39b..adb402f37061c3f7e5b21ff87deb5affda24e3ae 100644 (file)
 #include <pthread.h>
 #include "webcit.h"
 #include "webserver.h"
+#include "groupdav.h"
 
 void groupdav_main(struct httprequest *req) {
 
        struct httprequest *rptr;
+       char dav_method[SIZ];
+       char dav_pathname[SIZ];
 
        if (!WC->logged_in) {
                wprintf(
@@ -41,16 +44,35 @@ void groupdav_main(struct httprequest *req) {
                return;
        }
 
+       extract_token(dav_method, req->line, 0, ' ');
+       extract_token(dav_pathname, req->line, 1, ' ');
+
+       /*
+        * We like the GET method ... it's nice and simple.
+        */
+       if (!strcasecmp(dav_method, "GET")) {
+               groupdav_get(dav_pathname);
+               return;
+       }
+
+       /*
+        * Couldn't find what we were looking for.  Die in a car fire.
+        */
        wprintf(
-               "HTTP/1.1 404 Not found - FIXME\n"
+               "HTTP/1.1 404 not found\n"
                "Connection: close\n"
                "Content-Type: text/plain\n"
                "\n"
        );
-       wprintf("You are authenticated, but sent a bogus request.\n");
-       wprintf("WC->httpauth_user=%s\n", WC->httpauth_user);
-       wprintf("WC->httpauth_pass=%s\n", WC->httpauth_pass);   /* FIXME don't display this */
-       wprintf("WC->wc_session   =%d\n", WC->wc_session);
+       wprintf("The object or resource \"%s\" was not found.\n", dav_pathname);
+
+       /*
+        * FIXME ... after development is finished, get rid of all this
+        */
+       wprintf("\n\n\n ** DEBUGGING INFO FOLLOWS ** \n\n");
+       wprintf("WC->httpauth_user = %s\n", WC->httpauth_user);
+       wprintf("WC->httpauth_pass = (%d characters)\n", strlen(WC->httpauth_pass));
+       wprintf("WC->wc_session    = %d\n", WC->wc_session);
        
        for (rptr=req; rptr!=NULL; rptr=rptr->next) {
                wprintf("> %s\n", rptr->line);