X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fgroupdav_main.c;h=19b060c13eca53c369e064eac0a20f9c148a4343;hb=808f3be91dd6b6677e380695e2f16e6473141a7e;hp=6e57b4652931c817fa699b6e3abfdc1c7a24438d;hpb=5785b10a818ed914badeeb13f93d9bd31c8a1b64;p=citadel.git diff --git a/webcit/groupdav_main.c b/webcit/groupdav_main.c index 6e57b4652..19b060c13 100644 --- a/webcit/groupdav_main.c +++ b/webcit/groupdav_main.c @@ -5,22 +5,6 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "webcit.h" #include "webserver.h" #include "groupdav.h" @@ -28,12 +12,17 @@ /* * Output HTTP headers which are common to all requests. + * + * Please observe that we don't use the usual output_headers() + * and wDumpContent() functions in the GroupDAV subsystem, so we + * do our own header stuff here. + * */ void groupdav_common_headers(void) { - wprintf( - "Server: %s / %s\n" - "Connection: close\n", - SERVER, serv_info.serv_software + hprintf( + "Server: %s / %s\r\n" + "Connection: close\r\n", + PACKAGE_STRING, ChrPtr(serv_info.serv_software) ); } @@ -42,18 +31,19 @@ void groupdav_common_headers(void) { /* * string conversion function */ -void euid_escapize(char *target, char *source) { - int i; +void euid_escapize(char *target, const char *source) { + int i, len; int target_length = 0; strcpy(target, ""); - for (i=0; iline, 1, ' '); - unescape_input(dav_pathname); +// extract_token(dav_method, req->line, 0, ' ', sizeof dav_method); +// extract_token(dav_pathname, req->line, 1, ' ', sizeof dav_pathname); + //// TODO 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. + * + * (THIS IS DISABLED BECAUSE WE ARE NOW TRYING TO DO REAL DAV.) + * + if (strncasecmp(dav_pathname, "/groupdav", 9)) { + char buf[512]; + 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(ChrPtr(DavPathname), "//"), ds != NULL) { + strcpy(ds, ds+1); + } /* * If there's an If-Match: header, strip out the quotes if present, and * then if all that's left is an asterisk, make it go away entirely. */ - if (strlen(dav_ifmatch) > 0) { + len = strlen(dav_ifmatch); + if (len > 0) { + stripltlen(dav_ifmatch, &len); if (dav_ifmatch[0] == '\"') { - strcpy(dav_ifmatch, &dav_ifmatch[1]); - if (strtok(dav_ifmatch, "\"") != NULL) { - strcpy(strtok(dav_ifmatch, "\""), ""); + memmove (dav_ifmatch, &dav_ifmatch[1], len); + len --; + for (i=0; ihttp_host)) { + wprintf("%s://%s", + (is_https ? "https" : "http"), + WC->http_host); + } }