Minor fixes.

This commit is contained in:
Mauro D
2022-11-30 18:31:07 +00:00
parent 8ff26db481
commit bb0e42e13b
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -1360,6 +1360,16 @@ pub trait MimeHeaders<'x> {
.and_then(|cd| cd.attribute("filename"))
.or_else(|| self.content_type().and_then(|ct| ct.attribute("name")))
}
// Returns true is the content type matches
fn is_content_type(&self, type_: &str, subtype: &str) -> bool {
self.content_type().map_or(false, |ct| {
ct.c_type.eq_ignore_ascii_case(type_)
&& ct
.c_subtype
.as_ref()
.map_or(false, |st| st.eq_ignore_ascii_case(subtype))
})
}
}
impl<'x> MimeHeaders<'x> for Message<'x> {
+1 -1
View File
@@ -20,7 +20,7 @@ pub static MONTH: &[&str] = &[
impl DateTime {
/// Parses an RFC822 date
pub fn parse_rfc822(&self, value: &str) -> Option<Self> {
pub fn parse_rfc822(value: &str) -> Option<Self> {
match MessageStream::new(value.as_bytes()).parse_date() {
HeaderValue::DateTime(dt) => dt.into(),
_ => None,