]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
* Began laying the groundwork for http-authenticated GroupDAV sessions.
[citadel.git] / webcit / webcit.c
index 3206e503ee08e5a8c6cc5364a6a7f014cc52f2bc..8de0921483d3e8b0161de9e023e4f01aea37789f 100644 (file)
@@ -815,6 +815,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
 void session_loop(struct httprequest *req)
 {
        char cmd[SIZ];
+       char method[SIZ];
        char action[SIZ];
        char buf[SIZ];
        int a, b;
@@ -851,6 +852,7 @@ void session_loop(struct httprequest *req)
 
        strcpy(cmd, hptr->line);
        hptr = hptr->next;
+       extract_token(method, cmd, 0, ' ');
        extract_action(action, cmd);
 
        while (hptr != NULL) {
@@ -888,18 +890,9 @@ void session_loop(struct httprequest *req)
                                ContentType, ContentLength);
                body_start = strlen(content);
 
-/***** old version
-               BytesRead = 0;
-               while (BytesRead < ContentLength) {
-                       a=read(WC->http_sock, &content[BytesRead+body_start],
-                               ContentLength - BytesRead);
-                       if (a <= 0) BytesRead = ContentLength;
-                       else BytesRead += a;
-               }
-*******/
-
-               /* Now we're daring and read it all at once. */
-               client_read(WC->http_sock, &content[BytesRead+body_start], ContentLength);
+               /* Be daring and read it all at once. */
+               client_read(WC->http_sock, &content[BytesRead+body_start],
+                       ContentLength);
 
                if (!strncasecmp(ContentType,
                              "application/x-www-form-urlencoded", 33)) {
@@ -993,6 +986,14 @@ void session_loop(struct httprequest *req)
                goto SKIP_ALL_THIS_CRAP;
        }
 #endif
+       /* 
+        * The GroupDAV stuff relies on HTTP authentication instead of
+        * our session's authentication.
+        */
+       if (!strncasecmp(action, "groupdav", 8)) {
+               groupdav_main(cmd);
+               goto SKIP_ALL_THIS_CRAP;
+       }
 
        check_for_instant_messages();