StrBufExtract_token(dav_roomname, WCC->Hdr->HR.ReqLine, 0, '/');
StrBufExtract_token(dav_uid, WCC->Hdr->HR.ReqLine, 1, '/');
+ syslog(LOG_DEBUG, "\033[35m%s (logged_in=%d)\033[0m", ChrPtr(WCC->Hdr->HR.ReqLine), WC->logged_in);
/*
- * If the room name is blank, the client is doing a top-level OPTIONS.
+ * If the room name is blank, the client is doing an OPTIONS on the root.
*/
if (StrLength(dav_roomname) == 0) {
+ syslog(LOG_DEBUG, "\033[36mOPTIONS requested for root\033[0m");
hprintf("HTTP/1.1 200 OK\r\n");
dav_common_headers();
hprintf("Date: %s\r\n", datestring);
}
if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) {
+ syslog(LOG_DEBUG, "\033[36mOPTIONS requested for invalid item\033[0m");
hprintf("HTTP/1.1 404 not found\r\n");
dav_common_headers();
hprintf("Date: %s\r\n", datestring);
* a specific item in the room.
*/
if (StrLength(dav_uid) != 0) {
-
+ syslog(LOG_DEBUG, "\033[36mOPTIONS requested for specific item\033[0m");
dav_msgnum = locate_message_by_uid(ChrPtr(dav_uid));
if (dav_msgnum < 0) {
hprintf("HTTP/1.1 404 not found\r\n");
* We got to this point, which means that the client is requesting
* an OPTIONS on the room itself.
*/
+ syslog(LOG_DEBUG, "\033[36mOPTIONS requested for room '%s' (%slogged in)\033[0m",
+ ChrPtr(WC->CurRoom.name),
+ ((WC->logged_in) ? "" : "not ")
+ );
hprintf("HTTP/1.1 200 OK\r\n");
dav_common_headers();
hprintf("Date: %s\r\n", datestring);
- hprintf("DAV: 1\r\n");
+
+ /*
+ * Offer CalDAV (RFC 4791) if this is a calendar room
+ */
+ if ( (WC->CurRoom.view == VIEW_CALENDAR) || (WC->CurRoom.view == VIEW_CALBRIEF) ) {
+ hprintf("DAV: 1, calendar-access\r\n");
+ syslog(LOG_DEBUG, "\033[36mDAV: 1, calendar-access\033[0m");
+ }
+ else {
+ hprintf("DAV: 1\r\n");
+ syslog(LOG_DEBUG, "\033[36mDAV: 1\033[0m");
+ }
+
hprintf("Allow: OPTIONS, PROPFIND, GET, PUT\r\n");
begin_burst();
- wc_printf("\r\n");
end_burst();
}