* Any HTTP method other than GET or POST is now routed directly to the
authorArt Cancro <ajc@citadel.org>
Wed, 29 Jun 2005 17:55:32 +0000 (17:55 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 29 Jun 2005 17:55:32 +0000 (17:55 +0000)
  GroupDAV code.  This will eventually allow requests such as "PROPFIND /"
  to work.
* GroupDAV requests not beginning with "/groupdav" now automatically have
  that prefix prepended to them.

webcit/ChangeLog
webcit/groupdav.h
webcit/groupdav_main.c
webcit/webcit.c

index 5821c436591299d11771486be487a53007de5303..7072d616bdaadf6245f08fe78e508a15f8d2684c 100644 (file)
@@ -1,4 +1,11 @@
 $Log$
+Revision 619.19  2005/06/29 17:55:32  ajc
+* Any HTTP method other than GET or POST is now routed directly to the
+  GroupDAV code.  This will eventually allow requests such as "PROPFIND /"
+  to work.
+* GroupDAV requests not beginning with "/groupdav" now automatically have
+  that prefix prepended to them.
+
 Revision 619.18  2005/06/29 15:25:00  ajc
 * Added an experimental OPTIONS method.  This is not required by GroupDAV,
   but it is an experiment to see whether we can use the same code framework
@@ -2679,3 +2686,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 fa2ae002e8d47a417ebe1104e6fb8a9c85152d00..dfbb5f7dff5226adfd157754bc643398bd07f9d5 100644 (file)
@@ -6,6 +6,7 @@ void groupdav_get(char *);
 void groupdav_put(char *, char *, char *, char *);
 void groupdav_delete(char *, char *);
 void groupdav_propfind(char *);
+void groupdav_options(char *);
 long locate_message_by_uid(char *);
 void groupdav_folder_list(void);
 void euid_escapize(char *, char *);
index 11c874c9dec4b7f91e4090226f43c83eb473d632..fc4bfb595345d9340817726f95e1019b0ed0599b 100644 (file)
@@ -120,9 +120,10 @@ void groupdav_main(struct httprequest *req,
                        char *dav_content
 ) {
        struct httprequest *rptr;
-       char dav_method[SIZ];
-       char dav_pathname[SIZ];
-       char dav_ifmatch[SIZ];
+       char dav_method[256];
+       char dav_pathname[256];
+       char dav_ifmatch[256];
+       char buf[256];
        char *ds;
        int i;
 
@@ -154,6 +155,15 @@ void groupdav_main(struct httprequest *req,
        extract_token(dav_method, req->line, 0, ' ', sizeof dav_method);
        extract_token(dav_pathname, req->line, 1, ' ', sizeof dav_pathname);
        unescape_input(dav_pathname);
+
+       /* If the request does not begin with "/groupdav", prepend it.  If
+        * we happen to introduce a double-slash, that's ok; we'll strip it
+        * in the next step.
+        */
+       if (strncasecmp(dav_pathname, "/groupdav", 9)) {
+               snprintf(buf, sizeof buf, "/groupdav/%s", dav_pathname);
+               safestrncpy(dav_pathname, buf, sizeof dav_pathname);
+       }
        
        /* Remove any stray double-slashes in pathname */
        while (ds=strstr(dav_pathname, "//"), ds != NULL) {
index b6e5e91c043973f3541938319854639d24bcf15b..e4570532a2408763ca5afc02c73c8ac60e3bda79 100644 (file)
@@ -1081,14 +1081,15 @@ void session_loop(struct httprequest *req)
 
 
        /*
-        * If this isn't a GroupDAV session, it's an ordinary browser
-        * connecting to the user interface.  Only allow GET and POST
-        * methods.
+        * Automatically send requests with any method other than GET or
+        * POST to the GroupDAV code as well.
         */
        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");
+               groupdav_main(req, ContentType, /* do GroupDAV methods */
+                       ContentLength, content+body_start);
+               if (!WC->logged_in) {
+                       WC->killthis = 1;       /* If not logged in, don't */
+               }                               /* keep the session active */
                goto SKIP_ALL_THIS_CRAP;
        }