From 311bc59c1b35b748c1551a33480aaefd7cd50199 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 19 Mar 2024 18:30:26 +0100 Subject: Make Thunderbird sufficiently happy to send a REPORT --- aero-proto/src/dav.rs | 63 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'aero-proto/src') diff --git a/aero-proto/src/dav.rs b/aero-proto/src/dav.rs index 608aef1..0e2e01a 100644 --- a/aero-proto/src/dav.rs +++ b/aero-proto/src/dav.rs @@ -208,7 +208,7 @@ async fn router(user: std::sync::Arc, req: Request) -> Result return Ok(Response::builder() .status(200) .header("DAV", "1") - .header("ALLOW", "HEAD,GET,PUT,OPTIONS,DELETE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK") + .header("Allow", "HEAD,GET,PUT,OPTIONS,DELETE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK,MKCALENDAR,REPORT") .body(text_body(""))?), "HEAD" | "GET" => { tracing::warn!("HEAD+GET not correctly implemented"); @@ -223,27 +223,39 @@ async fn router(user: std::sync::Arc, req: Request) -> Result -/// -/// -/// -/// -/// -/// -/// - - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// +// +// +// +// +// +// +// +// + + +// +// +// +// +// +// +// +// +// +// +// + +// +// +// +// +// +// +// +// +// +// +// const ALLPROP: [dav::PropertyRequest; 10] = [ dav::PropertyRequest::CreationDate, @@ -609,6 +621,7 @@ impl DavNode for CalendarNode { dav::PropertyRequest::DisplayName, dav::PropertyRequest::ResourceType, dav::PropertyRequest::GetContentType, + dav::PropertyRequest::Extension(all::PropertyRequest::Cal(cal::PropertyRequest::SupportedCalendarComponentSet)), ]) } fn properties(&self, _user: &ArcUser, prop: dav::PropName) -> Vec> { @@ -621,6 +634,10 @@ impl DavNode for CalendarNode { //dav::PropertyRequest::GetContentType => dav::AnyProperty::Value(dav::Property::GetContentType("httpd/unix-directory".into())), //@FIXME seems wrong but seems to be what Thunderbird expects... dav::PropertyRequest::GetContentType => dav::AnyProperty::Value(dav::Property::GetContentType("text/calendar".into())), + dav::PropertyRequest::Extension(all::PropertyRequest::Cal(cal::PropertyRequest::SupportedCalendarComponentSet)) + => dav::AnyProperty::Value(dav::Property::Extension(all::Property::Cal(cal::Property::SupportedCalendarComponentSet(vec![ + cal::CompSupport(cal::Component::VEvent), + ])))), v => dav::AnyProperty::Request(v), }).collect() } @@ -650,6 +667,7 @@ impl DavNode for EventNode { dav::PropName(vec![ dav::PropertyRequest::DisplayName, dav::PropertyRequest::ResourceType, + dav::PropertyRequest::GetEtag, ]) } fn properties(&self, _user: &ArcUser, prop: dav::PropName) -> Vec> { @@ -657,6 +675,7 @@ impl DavNode for EventNode { dav::PropertyRequest::DisplayName => dav::AnyProperty::Value(dav::Property::DisplayName(format!("{} event", self.event_file))), dav::PropertyRequest::ResourceType => dav::AnyProperty::Value(dav::Property::ResourceType(vec![])), dav::PropertyRequest::GetContentType => dav::AnyProperty::Value(dav::Property::GetContentType("text/calendar".into())), + dav::PropertyRequest::GetEtag => dav::AnyProperty::Value(dav::Property::GetEtag("\"abcdefg\"".into())), v => dav::AnyProperty::Request(v), }).collect() } -- cgit v1.2.3