mirror of
https://github.com/stalwartlabs/stalwart.git
synced 2026-03-17 14:34:03 +00:00
WebDAV: Return 304 NOT_MODIFIED on If-None-Match
This commit is contained in:
@@ -5,18 +5,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
Collation, MatchType,
|
||||||
property::{DavProperty, DavValue, LockScope, LockType},
|
property::{DavProperty, DavValue, LockScope, LockType},
|
||||||
response::Ace,
|
response::Ace,
|
||||||
Collation, MatchType,
|
|
||||||
};
|
};
|
||||||
use crate::Depth;
|
use crate::{Condition, Depth};
|
||||||
use calcard::{
|
use calcard::{
|
||||||
icalendar::{ICalendarComponentType, ICalendarParameterName, ICalendarProperty},
|
icalendar::{ICalendarComponentType, ICalendarParameterName, ICalendarProperty},
|
||||||
vcard::{VCardParameterName, VCardProperty},
|
vcard::{VCardParameterName, VCardProperty},
|
||||||
};
|
};
|
||||||
use types::{
|
use types::{
|
||||||
dead_property::{ArchivedDeadProperty, ArchivedDeadPropertyTag, DeadElementTag, DeadProperty},
|
|
||||||
TimeRange,
|
TimeRange,
|
||||||
|
dead_property::{ArchivedDeadProperty, ArchivedDeadPropertyTag, DeadElementTag, DeadProperty},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
@@ -284,3 +284,12 @@ impl DavDeadProperty for ArchivedDeadProperty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Condition<'_> {
|
||||||
|
pub fn is_none_match(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Condition::ETag { is_not, .. } | Condition::Exists { is_not } => *is_not,
|
||||||
|
Condition::StateToken { .. } => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -605,7 +605,18 @@ impl LockRequestHandler for Server {
|
|||||||
return lock_response;
|
return lock_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(DavError::Code(StatusCode::PRECONDITION_FAILED))
|
Err(DavError::Code(
|
||||||
|
if matches!(method, DavMethod::GET | DavMethod::HEAD)
|
||||||
|
&& headers
|
||||||
|
.if_
|
||||||
|
.iter()
|
||||||
|
.any(|if_| if_.list.iter().any(|cond| cond.is_none_match()))
|
||||||
|
{
|
||||||
|
StatusCode::NOT_MODIFIED
|
||||||
|
} else {
|
||||||
|
StatusCode::PRECONDITION_FAILED
|
||||||
|
},
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user