$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
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
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 *);
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;
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) {
/*
- * 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;
}