+ /**
+ * GroupDAV-based sessions use HTTP authentication
+ */
+ if (GetHash(HTTPHeaders, HKEY("AUTHORIZATION"), &vLine) &&
+ (vLine != NULL)) {
+ Line = (StrBuf*)vLine;
+ if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
+ StrBufCutLeft(Line, 6);
+ CtdlDecodeBase64(httpauth_string, ChrPtr(Line), StrLength(Line));
+ extract_token(httpauth_user, httpauth_string, 0, ':', sizeof httpauth_user);
+ extract_token(httpauth_pass, httpauth_string, 1, ':', sizeof httpauth_pass);
+ }
+ else
+ lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
+ }
+
+ if (GetHash(HTTPHeaders, HKEY("IF-MODIFIED-SINCE"), &vLine) &&
+ (vLine != NULL)) {
+ if_modified_since = httpdate_to_timestamp((StrBuf*)vLine);
+ }
+
+ if (GetHash(HTTPHeaders, HKEY("ACCEPT-LANGUAGE"), &vLine) &&
+ (vLine != NULL)) {
+ accept_language = (StrBuf*) vLine;
+ }
+
+
+ /**
+ * If the request is prefixed by "/webcit" then chop that off. This
+ * allows a front end web server to forward all /webcit requests to us
+ * while still using the same web server port for other things.
+ */
+
+ ReqType = NewStrBuf();
+ HTTPVersion = NewStrBuf();
+ StrBufExtract_token(HTTPVersion, ReqLine, 2, ' ');
+ StrBufExtract_token(ReqType, ReqLine, 0, ' ');
+ StrBufCutLeft(ReqLine, StrLength(ReqType) + 1);
+ StrBufCutRight(ReqLine, StrLength(HTTPVersion) + 1);
+
+ if ((follow_xff == 1) && (StrLength(ReqLine) >= 8) &&
+ (ptr = strstr(ChrPtr(ReqLine), "/webcit/"), /*< Handle "/webcit/" */
+ (ptr != NULL))) {
+ StrBufCutLeft(ReqLine, 7);
+ }
+
+ /** Begin parsing the request. */
+#ifdef TECH_PREVIEW
+ if ((strncmp(ChrPtr(ReqLine), "/sslg", 5) != 0) &&
+ (strncmp(ChrPtr(ReqLine), "/static/", 8) != 0) &&
+ (strncmp(ChrPtr(ReqLine), "/tiny_mce/", 10) != 0) &&
+ (strncmp(ChrPtr(ReqLine), "/wholist_section", 16) != 0) &&
+ (strstr(ChrPtr(ReqLine), "wholist_section") == NULL)) {
+#endif
+ lprintf(5, "HTTP: %s %s %s\n", ChrPtr(ReqType), ChrPtr(ReqLine), ChrPtr(HTTPVersion));
+#ifdef TECH_PREVIEW
+ }
+#endif
+
+ /** Check for bogus requests */
+ if ((StrLength(HTTPVersion) == 0) ||
+ (StrLength(ReqType) == 0) ||
+ is_bogus(ReqLine)) {
+ StrBufPlain(ReqLine, HKEY("/404 HTTP/1.1"));
+ StrBufPlain(ReqType, HKEY("GET"));
+ }
+ FreeStrBuf(&HTTPVersion);
+
+ /**