]> code.citadel.org Git - citadel.git/commitdiff
* More GroupDAV fixes and tuning.
authorArt Cancro <ajc@citadel.org>
Wed, 9 Feb 2005 04:37:32 +0000 (04:37 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 9 Feb 2005 04:37:32 +0000 (04:37 +0000)
webcit/ChangeLog
webcit/groupdav_main.c
webcit/groupdav_put.c
webcit/webcit.c
webcit/webserver.c

index 597840a80dff8daf569d5b5c5493acc92be8da02..ce91998c3a9050e532a0ecafd15b3e3163f74db4 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 528.47  2005/02/09 04:37:32  ajc
+* More GroupDAV fixes and tuning.
+
 Revision 528.46  2005/02/07 22:02:00  ajc
 * groupdav_propfind.c: output all XML on a single line, with no linebreaks,
   and no whitespace between tags.  We have discovered that doing otherwise
@@ -2331,3 +2334,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 92d913134447335555e34a7d76ad717024c3d9b4..748bddd9f9381c5f40018bfcb91e0b38d9401fe1 100644 (file)
@@ -118,6 +118,7 @@ void groupdav_main(struct httprequest *req,
        char dav_method[SIZ];
        char dav_pathname[SIZ];
        char dav_ifmatch[SIZ];
+       int i;
 
        strcpy(dav_method, "");
        strcpy(dav_pathname, "");
@@ -153,10 +154,13 @@ void groupdav_main(struct httprequest *req,
         * then if all that's left is an asterisk, make it go away entirely.
         */
        if (strlen(dav_ifmatch) > 0) {
+               striplt(dav_ifmatch);
                if (dav_ifmatch[0] == '\"') {
                        strcpy(dav_ifmatch, &dav_ifmatch[1]);
-                       if (strtok(dav_ifmatch, "\"") != NULL) {
-                               strcpy(strtok(dav_ifmatch, "\""), "");
+                       for (i=0; i<strlen(dav_ifmatch); ++i) {
+                               if (dav_ifmatch[i] == '\"') {
+                                       dav_ifmatch[i] = 0;
+                               }
                        }
                }
                if (!strcmp(dav_ifmatch, "*")) {
index 9825537c31539f3618823a27fa25b329685d5b70..aeb25f2592781754f4faefa531d770e83f0cecb7 100644 (file)
@@ -98,9 +98,12 @@ void groupdav_put(char *dav_pathname, char *dav_ifmatch,
         * version, so we fail...
         */
        if (strlen(dav_ifmatch) > 0) {
+               lprintf(9, "dav_ifmatch: %s\n", dav_ifmatch);
                old_msgnum = locate_message_by_uid(dav_uid);
+               lprintf(9, "old_msgnum:  %ld\n", old_msgnum);
                if (atol(dav_ifmatch) != old_msgnum) {
                        wprintf("HTTP/1.1 412 Precondition Failed\r\n");
+                       lprintf(9, "HTTP/1.1 412 Precondition Failed\r\n");
                        groupdav_common_headers();
                        wprintf("Content-Length: 0\r\n\r\n");
                        return;
@@ -162,6 +165,7 @@ void groupdav_put(char *dav_pathname, char *dav_ifmatch,
        /* We created this item for the first time. */
        if (old_msgnum < 0L) {
                wprintf("HTTP/1.1 201 Created\r\n");
+               lprintf(9, "HTTP/1.1 201 Created\r\n");
                groupdav_common_headers();
                wprintf("Content-Length: 0\r\n");
                wprintf("Location: ");
@@ -179,6 +183,7 @@ void groupdav_put(char *dav_pathname, char *dav_ifmatch,
 
        /* We modified an existing item. */
        wprintf("HTTP/1.1 204 No Content\r\n");
+       lprintf(9, "HTTP/1.1 204 No Content\r\n");
        groupdav_common_headers();
        wprintf("Content-Length: 0\r\n\r\n");
 
index 7dfca75d200929331129a7090b00285c6e0ce996..7fdf3a8a7ec732e3d5cc3c1694dda058ba2fbb1b 100644 (file)
@@ -1038,6 +1038,19 @@ void session_loop(struct httprequest *req)
                goto SKIP_ALL_THIS_CRAP;
        }
 
+
+       /*
+        * If this isn't a GroupDAV session, it's an ordinary browser
+        * connecting to the user interface.  Only allow GET and POST
+        * methods.
+        */
+       if ((strcasecmp(method, "GET")) && (strcasecmp(method, "POST"))) {
+               wprintf("HTTP/1.1 405 Method Not Allowed\r\n");
+               groupdav_common_headers();
+               wprintf("Content-Length: 0\r\n\r\n");
+               goto SKIP_ALL_THIS_CRAP;
+       }
+
        check_for_instant_messages();
 
        /*
index 07e3543ad97bbde1a81e20ee96497e81a343f121..d6f56d77312a440b951aaf3b6160c80fd0c48a93 100644 (file)
@@ -9,8 +9,8 @@
 
 /*
  * Uncomment to dump an HTTP trace to stderr
- */
 #define HTTP_TRACING 1
+ */
 
 #include <ctype.h>
 #include <stdlib.h>