WIP mime headers
This commit is contained in:
parent
541c92f088
commit
d64b7a0bbc
3 changed files with 24 additions and 0 deletions
|
@ -97,6 +97,7 @@ Todo:
|
||||||
| 🔴 |2047 | ↳ MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text |
|
| 🔴 |2047 | ↳ MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text |
|
||||||
| 🔴 |2048 | ↳ Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures |
|
| 🔴 |2048 | ↳ Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures |
|
||||||
| 🔴 |2049 | ↳ Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples |
|
| 🔴 |2049 | ↳ Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples |
|
||||||
|
| 🔴 |2183 | Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field |
|
||||||
| 🟩 |6532 | Internationalized Email Headers |
|
| 🟩 |6532 | Internationalized Email Headers |
|
||||||
| 🔴 |9228 | Delivered-To Email Header Field |
|
| 🔴 |9228 | Delivered-To Email Header Field |
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ impl<'a> TryFrom<&'a Lazy<'a>> for Field<'a> {
|
||||||
Lazy::ReturnPath(v) => v.try_into().map(|v| ReturnPath(v)),
|
Lazy::ReturnPath(v) => v.try_into().map(|v| ReturnPath(v)),
|
||||||
Lazy::Optional(k, v) => v.try_into().map(|v| Optional(k, v)),
|
Lazy::Optional(k, v) => v.try_into().map(|v| Optional(k, v)),
|
||||||
Lazy::Rescue(v) => Ok(Rescue(v)),
|
Lazy::Rescue(v) => Ok(Rescue(v)),
|
||||||
|
_ => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,15 @@ pub struct ReceivedLog<'a>(pub &'a str);
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Path<'a>(pub &'a str);
|
pub struct Path<'a>(pub &'a str);
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct Version<'a>(pub &'a str);
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct Type<'a>(pub &'a str);
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct Mechanism<'a>(pub &'a str);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum Field<'a> {
|
pub enum Field<'a> {
|
||||||
// 3.6.1. The Origination Date Field
|
// 3.6.1. The Origination Date Field
|
||||||
|
@ -70,6 +79,13 @@ pub enum Field<'a> {
|
||||||
Received(ReceivedLog<'a>),
|
Received(ReceivedLog<'a>),
|
||||||
ReturnPath(Mailbox<'a>),
|
ReturnPath(Mailbox<'a>),
|
||||||
|
|
||||||
|
// MIME RFC 2045
|
||||||
|
MIMEVersion(Version<'a>),
|
||||||
|
ContentType(Type<'a>),
|
||||||
|
ContentTransferEncoding(Mechanism<'a>),
|
||||||
|
ContentID(Identifier<'a>),
|
||||||
|
ContentDescription(Unstructured<'a>),
|
||||||
|
|
||||||
// 3.6.8. Optional Fields
|
// 3.6.8. Optional Fields
|
||||||
Optional(&'a str, Unstructured<'a>),
|
Optional(&'a str, Unstructured<'a>),
|
||||||
|
|
||||||
|
@ -128,6 +144,12 @@ fn correct_field(input: &str) -> IResult<&str, Field> {
|
||||||
"return-path" => ReturnPath(Mailbox(rest)),
|
"return-path" => ReturnPath(Mailbox(rest)),
|
||||||
"received" => Received(ReceivedLog(rest)),
|
"received" => Received(ReceivedLog(rest)),
|
||||||
|
|
||||||
|
"mime-version" => MIMEVersion(Version(rest)),
|
||||||
|
"content-type" => ContentType(Type(rest)),
|
||||||
|
"content-transfer-encoding" => ContentTransferEncoding(Mechanism(rest)),
|
||||||
|
"content-id" => ContentID(Identifier(rest)),
|
||||||
|
"content-description" => ContentDescription(Unstructured(rest)),
|
||||||
|
|
||||||
_ => Optional(name, Unstructured(rest)),
|
_ => Optional(name, Unstructured(rest)),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue