diff --git a/README.md b/README.md index ee30c67..cf16005 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,8 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 let nested_message = message .get_attachment(0) .unwrap() - .unwrap_message(); + .get_message(); + .unwrap(); assert_eq!( nested_message.get_subject().unwrap(), @@ -154,7 +155,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 "
ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); - let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); + let nested_attachment = nested_message.get_attachment(0).unwrap(); assert_eq!(nested_attachment.len(), 42); diff --git a/src/lib.rs b/src/lib.rs index c84d213..dfd756f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -216,7 +216,8 @@ //! let nested_message = message //! .get_attachment(0) //! .unwrap() -//! .unwrap_message(); +//! .get_message() +//! .unwrap(); //! //! assert_eq!( //! nested_message.get_subject().unwrap(), @@ -233,7 +234,7 @@ //! "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" //! ); //! -//! let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); +//! let nested_attachment = nested_message.get_attachment(0).unwrap(); //! //! assert_eq!(nested_attachment.len(), 42); //! @@ -1244,7 +1245,14 @@ impl<'x> MessagePart<'x> { /// Returns the body part's length pub fn len(&self) -> usize { - self.offset_end.saturating_sub(self.offset_header) + match &self.body { + PartType::Text(text) | PartType::Html(text) => text.len(), + PartType::Binary(bin) + | PartType::InlineBinary(bin) + | PartType::Message(MessageAttachment::Raw(bin)) => bin.len(), + PartType::Message(MessageAttachment::Parsed(message)) => message.raw_message.len(), + PartType::Multipart(_) => 0, + } } /// Returns `true` when the body part MIME type is text/* @@ -1277,9 +1285,24 @@ impl<'x> MessagePart<'x> { &self.headers_rfc } - /// Get the raw offsets of this part - pub fn raw_offsets(&self) -> (usize, usize, usize) { - (self.offset_header, self.offset_body, self.offset_end) + /// Returns the body raw length + pub fn raw_len(&self) -> usize { + self.offset_end.saturating_sub(self.offset_header) + } + + /// Get the raw header offset of this part + pub fn raw_header_offset(&self) -> usize { + self.offset_header + } + + /// Get the raw body offset of this part + pub fn raw_body_offset(&self) -> usize { + self.offset_body + } + + /// Get the raw body end offset of this part + pub fn raw_end_offset(&self) -> usize { + self.offset_header } } diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 3d1ccfd..2fb30d3 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -613,7 +613,7 @@ mod tests { use crate::{ parsers::message::Message, HeaderValue, MessagePart, MessagePartId, PartType, RawHeaders, - RfcHeader, RfcHeaders, + RfcHeader, }; const SEPARATOR: &[u8] = "\n---- EXPECTED STRUCTURE ----".as_bytes(); @@ -664,7 +664,7 @@ mod tests { #[test] fn parse_full_messages() { - for test_suite in ["rfc", "legacy", "thirdparty", "malformed"] { + for test_suite in ["malformed", "rfc", "legacy", "thirdparty", "malformed"] { let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); test_dir.push("tests"); test_dir.push(test_suite); @@ -791,78 +791,14 @@ mod tests { output.extend_from_slice(input.0); output.extend_from_slice(SEPARATOR); output.extend_from_slice( - serde_json::to_string_pretty(&Message::parse(input.0).unwrap()) - .unwrap() - .as_bytes(), + serde_json::to_string_pretty(&SortedMessage::from( + Message::parse(input.0).unwrap(), + )) + .unwrap() + .as_bytes(), ); fs::write(file_name.as_ref().unwrap().path(), &output).unwrap(); } } }*/ - - /*#[test] - fn raw_parts() { - let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - test_dir.push("tests"); - test_dir.push("malformed"); - test_dir.push("007.txt"); - let mut input = fs::read(&test_dir).unwrap(); - let mut pos = 0; - - /*let mut input = Vec::with_capacity(input_.len()); - for ch in &input_ { - if ch == &b'\r' { - continue; - } else if ch == &b'\n' { - input.push(b'\r'); - } - input.push(*ch); - }*/ - for sep_pos in 0..input.len() { - if input[sep_pos..sep_pos + SEPARATOR.len()].eq(SEPARATOR) { - pos = sep_pos; - break; - } - } - - let (raw_message, other) = input.split_at_mut(pos); - let message = Message::parse(raw_message).unwrap(); - print_stuff(&message, raw_message); - } - - fn print_stuff(message: &Message, raw_message: &[u8]) { - for (pos, part) in message.parts.iter().enumerate() { - let (start, mid, end) = part.raw_offsets(); - - println!( - "part {}, header {:?}\ncontent: {:?}\nrealcontent: {:?}\n", - pos, - std::str::from_utf8(&raw_message[start..mid]).unwrap(), - std::str::from_utf8(&raw_message[mid..end]).unwrap(), - match part { - crate::MessagePart::Text(text) | crate::MessagePart::Html(text) => - text.body.clone(), - crate::MessagePart::Binary(bin) | crate::MessagePart::InlineBinary(bin) => - String::from_utf8_lossy(&bin.body), - crate::MessagePart::Message(_) | crate::MessagePart::Multipart(_) => "".into(), - } - ); - if let crate::MessagePart::Message(sub) = part { - println!("---- FROM ----"); - match &sub.body { - crate::MessageAttachment::Parsed(message) => { - println!( - "coco {:?}", - std::str::from_utf8(message.raw_message.as_ref()).unwrap() - ); - print_stuff(message, raw_message); - } - crate::MessageAttachment::Raw(raw) => { - print_stuff(&Message::parse(raw.as_ref()).unwrap(), raw); - } - } - println!("---- TO ----"); - } - } - }*/ } diff --git a/tests/legacy/000.txt b/tests/legacy/000.txt index 8fa3b1a..350ebc4 100644 --- a/tests/legacy/000.txt +++ b/tests/legacy/000.txt @@ -43,170 +43,6 @@ tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5 IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 35, - "second": 5, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 76 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 84, - "end": 125 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 130, - "end": 164 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 175, - "end": 225 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 238, - "end": 244 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 257, - "end": 291 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 317, - "end": 326 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 346, - "end": 385 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 396, - "end": 409 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 427, - "end": 436 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 445, - "end": 498 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 509, - "end": 518 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 528, - "end": 576 - } - ] - ], "html_body": [], "text_body": [], "attachments": [ @@ -214,61 +50,194 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ], "parts": [ { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } + "headers_rfc": { + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 35, + "second": 5, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 257, - "end": 291 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 317, - "end": 326 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 346, - "end": 385 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 76 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 84, + "end": 125 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 130, + "end": 164 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 175, + "end": 225 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 238, + "end": 244 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 257, + "end": 291 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 317, + "end": 326 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 346, + "end": 385 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 396, + "end": 409 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 427, + "end": 436 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 445, + "end": 498 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 509, + "end": 518 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 528, + "end": 576 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1722,17 +1691,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 0, - "offset_body": 578, - "offset_end": 2570 - } + ] + }, + "offset_header": 0, + "offset_body": 578, + "offset_end": 2570 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 578, - "offset_end": 2570 + ] } \ No newline at end of file diff --git a/tests/legacy/001.txt b/tests/legacy/001.txt index 47255e4..187bd5c 100644 --- a/tests/legacy/001.txt +++ b/tests/legacy/001.txt @@ -34,167 +34,6 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "jblow@example.com" - }, - { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - ] - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 18, - "second": 39, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 39 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 42, - "end": 146 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 154, - "end": 224 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 229, - "end": 262 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 273, - "end": 322 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 335, - "end": 340 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 353, - "end": 383 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 409, - "end": 427 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 438, - "end": 450 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 468, - "end": 476 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 485, - "end": 537 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 548, - "end": 556 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 566, - "end": 613 - } - ] - ], "html_body": [ 0 ], @@ -204,53 +43,186 @@ m+APw-ssen als wir.+ACI-=20 "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ + "to": { + "AddressList": [ { - "Rfc": "content_type" + "name": "Joe Blow", + "address": "jblow@example.com" }, { - "start": 353, - "end": 383 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 409, - "end": 427 + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 18, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-7" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 39 + } ], - "is_encoding_problem": false, - "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "offset_header": 0, - "offset_body": 614, - "offset_end": 1491 - } + [ + { + "Rfc": "to" + }, + { + "start": 42, + "end": 146 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 154, + "end": 224 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 229, + "end": 262 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 273, + "end": 322 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 335, + "end": 340 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 353, + "end": 383 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 409, + "end": 427 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 438, + "end": 450 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 468, + "end": 476 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 485, + "end": 537 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 548, + "end": 556 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 566, + "end": 613 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" + }, + "offset_header": 0, + "offset_body": 614, + "offset_end": 1491 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 614, - "offset_end": 1491 + ] } \ No newline at end of file diff --git a/tests/legacy/002.txt b/tests/legacy/002.txt index 65ea5a3..98aeab4 100644 --- a/tests/legacy/002.txt +++ b/tests/legacy/002.txt @@ -36,143 +36,6 @@ wir."Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n
\r\n",
- "offset_header": 1529,
- "offset_body": 1607,
- "offset_end": 2556
- }
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 668,
+ "end": 687
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
+ },
+ "offset_header": 596,
+ "offset_body": 689,
+ "offset_end": 1489
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "html",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
+ {
+ "start": 1542,
+ "end": 1572
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1598,
+ "end": 1605
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Html": "\r\n\r\nDie Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n
\r\n"
+ },
+ "offset_header": 1529,
+ "offset_body": 1607,
+ "offset_end": 2558
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 2655,
- "end": 2691
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 2717,
- "end": 2726
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 2746,
- "end": 2783
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 2655,
+ "end": 2691
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 2717,
+ "end": 2726
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 2746,
+ "end": 2783
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -1745,68 +1763,68 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 2642,
- "offset_body": 2785,
- "offset_end": 4565
- }
+ ]
+ },
+ "offset_header": 2642,
+ "offset_body": 2785,
+ "offset_end": 4567
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 4620,
- "end": 4655
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 4681,
- "end": 4690
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 4710,
- "end": 4746
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 4620,
+ "end": 4655
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 4681,
+ "end": 4690
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 4710,
+ "end": 4746
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -3132,37 +3150,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 4607,
- "offset_body": 4748,
- "offset_end": 6564
- }
- }
- ],
- "structure": {
- "List": [
- {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
- }
- ]
]
},
- {
- "Part": 3
- },
- {
- "Part": 4
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 6606
+ "offset_header": 4607,
+ "offset_body": 4748,
+ "offset_end": 6566
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/033.txt b/tests/legacy/033.txt
index ff47fb6..0d470b4 100644
--- a/tests/legacy/033.txt
+++ b/tests/legacy/033.txt
@@ -33,143 +33,6 @@ wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 30,
- "second": 41,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "message_id": {
- "Text": "392363E1.2AC47AB3@example.com"
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Other": "X-Priority"
- },
- {
- "start": 305,
- "end": 318
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 331,
- "end": 359
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 385,
- "end": 404
- }
- ]
- ],
"html_body": [
0
],
@@ -179,53 +42,162 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "UTF-8"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 331,
- "end": 359
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 30,
+ "second": 41,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "392363E1.2AC47AB3@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "UTF-8"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 385,
- "end": 404
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Fr�sche\n\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der\nTod selbst. Auf, la�t uns ein f�r allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt\nerschreckte eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs\nschnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\n",
- "offset_header": 0,
- "offset_body": 406,
- "offset_end": 1208
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Other": "X-Priority"
+ },
+ {
+ "start": 305,
+ "end": 318
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 331,
+ "end": 359
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 385,
+ "end": 404
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Fr�sche\n\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der\nTod selbst. Auf, la�t uns ein f�r allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt\nerschreckte eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs\nschnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\n"
+ },
+ "offset_header": 0,
+ "offset_body": 406,
+ "offset_end": 1208
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 406,
- "offset_end": 1208
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/034.txt b/tests/legacy/034.txt
index 40f55cb..7db0642 100644
--- a/tests/legacy/034.txt
+++ b/tests/legacy/034.txt
@@ -26,134 +26,6 @@ wenig aufschieben, denn auch uns f+vGM-hten, wie ihr seht, einige Tiere,
welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir."
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "message_id": {
- "Text": "39236497.12FA2A89@example.com"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "subject": {
- "Text": "Die Hasen und die Fr+APY-sche"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Heinz M+APw-ller",
- "address": "mueller@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 33,
- "second": 43,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 253
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 261,
- "end": 293
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 306,
- "end": 334
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 360,
- "end": 367
- }
- ]
- ],
"html_body": [
0
],
@@ -163,53 +35,153 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir."
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "7bit"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "UTF-7"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Fr+APY-sche"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 306,
- "end": 334
+ "to": {
+ "Address": {
+ "name": "Heinz M+APw-ller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 33,
+ "second": 43,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "39236497.12FA2A89@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "UTF-7"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 360,
- "end": 367
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Fr岣he\r\n\r\nDie Hasen klagten einst 롥r ihre miެiche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\r\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist 㱧er als der\r\nTod selbst. Auf, la uns ein f밠allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ers㴦en; sie eilten ihm zu;\r\nallein das auޥrordentliche Get岥 und ihre wunderbare Gestalt\r\nerschreckte eine Menge Fr岣he, die am Ufer saޥn, so sehr, daݠsie aufs\r\nschnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers㴦en noch ein\r\nwenig aufschieben, denn auch uns f뱣hten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl뢫licher sein m벳en als wir.\"\r\n",
- "offset_header": 0,
- "offset_body": 369,
- "offset_end": 1158
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 253
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 261,
+ "end": 293
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 306,
+ "end": 334
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 360,
+ "end": 367
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Fr岣he\r\n\r\nDie Hasen klagten einst 롥r ihre miެiche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\r\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist 㱧er als der\r\nTod selbst. Auf, la uns ein f밠allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ers㴦en; sie eilten ihm zu;\r\nallein das auޥrordentliche Get岥 und ihre wunderbare Gestalt\r\nerschreckte eine Menge Fr岣he, die am Ufer saޥn, so sehr, daݠsie aufs\r\nschnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers㴦en noch ein\r\nwenig aufschieben, denn auch uns f뱣hten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl뢫licher sein m벳en als wir.\"\r\n"
+ },
+ "offset_header": 0,
+ "offset_body": 369,
+ "offset_end": 1158
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 369,
- "offset_end": 1158
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/035.txt b/tests/legacy/035.txt
index 01878e0..f839293 100644
--- a/tests/legacy/035.txt
+++ b/tests/legacy/035.txt
@@ -212,361 +212,385 @@ YII=
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 13,
- "second": 9,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------A1E83A41894D3755390B838A"
- }
- }
- },
- "message_id": {
- "Text": "39235FC5.276CCE00@example.com"
- },
- "to": {
- "Address": {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- },
- "subject": {
- "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 266
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 274,
- "end": 346
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 359,
- "end": 428
- }
- ]
- ],
"html_body": [
- 3,
- 6,
- 7
+ 4,
+ 7,
+ 8
],
"text_body": [
- 1,
- 6,
- 7
+ 2,
+ 7,
+ 8
],
"attachments": [
- 4,
5,
6,
- 7
+ 7,
+ 8
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "alternative",
- "attributes": {
- "boundary": "------------F03F94BA73D3B9E8C1B94D92"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 529,
- "end": 604
+ "to": {
+ "Address": {
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 13,
+ "second": 9,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "39235FC5.276CCE00@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------A1E83A41894D3755390B838A"
}
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "offset_header": 516,
- "offset_body": 606,
- "offset_end": 7265
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 266
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 274,
+ "end": 346
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 359,
+ "end": 428
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 7,
+ 8
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 430,
+ "offset_end": 11447
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "alternative",
+ "attributes": {
+ "boundary": "------------F03F94BA73D3B9E8C1B94D92"
}
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 661,
- "end": 694
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 720,
- "end": 739
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "[blue ball]\n\nDie Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n[Image]\n\n\n",
- "offset_header": 648,
- "offset_body": 741,
- "offset_end": 1565
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 529,
+ "end": 604
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 516,
+ "offset_body": 606,
+ "offset_end": 7265
},
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "related",
- "attributes": {
- "boundary": "------------C02FA3D0A04E95F295FB25EB"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1620,
- "end": 1691
- }
- ]
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 661,
+ "end": 694
+ }
],
- "offset_header": 1607,
- "offset_body": 1693,
- "offset_end": 7221
- }
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 720,
+ "end": 739
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "[blue ball]\n\nDie Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n[Image]\n\n\n"
+ },
+ "offset_header": 648,
+ "offset_body": 741,
+ "offset_end": 1567
},
{
- "Html": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "html",
- "attributes": {
- "charset": "us-ascii"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "related",
+ "attributes": {
+ "boundary": "------------C02FA3D0A04E95F295FB25EB"
}
- },
- "content_transfer_encoding": {
- "Text": "7bit"
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1748,
- "end": 1778
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1804,
- "end": 1811
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "\r\n\r\n\r\n
Die Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n
\r\n
\r\n",
- "offset_header": 1735,
- "offset_body": 1813,
- "offset_end": 2935
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1620,
+ "end": 1691
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 4,
+ 5,
+ 6
+ ]
+ },
+ "offset_header": 1607,
+ "offset_body": 1693,
+ "offset_end": 7221
},
{
- "Binary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "C:TEMPnsmailEG.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "html",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": null
- }
+ {
+ "start": 1748,
+ "end": 1778
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
},
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_id": {
- "Text": "part1.39235FC5.E71D8178@example.com"
+ {
+ "start": 1804,
+ "end": 1811
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Html": "\r\n\r\n\r\n
Die Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n
\r\n
\r\n"
+ },
+ "offset_header": 1735,
+ "offset_body": 1813,
+ "offset_end": 2937
+ },
+ {
+ "headers_rfc": {
+ "content_id": {
+ "Text": "part1.39235FC5.E71D8178@example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": null
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 2990,
- "end": 3002
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "C:TEMPnsmailEG.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 3013,
- "end": 3053
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 3079,
- "end": 3088
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 3108,
- "end": 3150
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 2990,
+ "end": 3002
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 3013,
+ "end": 3053
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 3079,
+ "end": 3088
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 3108,
+ "end": 3150
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -1892,78 +1916,78 @@ YII=
66,
96,
130
- ],
- "offset_header": 2977,
- "offset_body": 3152,
- "offset_end": 4968
- }
+ ]
+ },
+ "offset_header": 2977,
+ "offset_body": 3152,
+ "offset_end": 4970
},
{
- "Binary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_id": {
- "Text": "part2.39235FC5.E71D8178@example.com"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": null
- }
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "C:TEMPnsmail39.png"
- }
- }
+ "headers_rfc": {
+ "content_id": {
+ "Text": "part2.39235FC5.E71D8178@example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": null
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 5023,
- "end": 5035
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "C:TEMPnsmail39.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 5046,
- "end": 5086
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 5112,
- "end": 5121
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 5141,
- "end": 5183
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 5023,
+ "end": 5035
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 5046,
+ "end": 5086
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 5112,
+ "end": 5121
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 5141,
+ "end": 5183
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -3417,68 +3441,68 @@ YII=
66,
96,
130
- ],
- "offset_header": 5010,
- "offset_body": 5185,
- "offset_end": 7177
- }
+ ]
+ },
+ "offset_header": 5010,
+ "offset_body": 5185,
+ "offset_end": 7179
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "redball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "redball.png"
}
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "redball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 7320,
- "end": 7354
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "redball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 7380,
- "end": 7389
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 7409,
- "end": 7444
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 7320,
+ "end": 7354
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 7380,
+ "end": 7389
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 7409,
+ "end": 7444
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -4932,68 +4956,68 @@ YII=
66,
96,
130
- ],
- "offset_header": 7307,
- "offset_body": 7446,
- "offset_end": 9438
- }
+ ]
+ },
+ "offset_header": 7307,
+ "offset_body": 7446,
+ "offset_end": 9440
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
- }
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 9493,
- "end": 9529
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 9555,
- "end": 9564
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 9584,
- "end": 9621
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 9493,
+ "end": 9529
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 9555,
+ "end": 9564
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 9584,
+ "end": 9621
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -6292,50 +6316,11 @@ YII=
66,
96,
130
- ],
- "offset_header": 9480,
- "offset_body": 9623,
- "offset_end": 11403
- }
- }
- ],
- "structure": {
- "List": [
- {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "MultiPart": [
- 2,
- [
- {
- "Part": 3
- },
- {
- "Part": 4
- },
- {
- "Part": 5
- }
- ]
- ]
- }
- ]
]
},
- {
- "Part": 6
- },
- {
- "Part": 7
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 430,
- "offset_end": 11445
+ "offset_header": 9480,
+ "offset_body": 9623,
+ "offset_end": 11405
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/036.txt b/tests/legacy/036.txt
index c89e1f2..4001cc5 100644
--- a/tests/legacy/036.txt
+++ b/tests/legacy/036.txt
@@ -26,116 +26,6 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@penguin.example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Jürgen Schmürgen",
- "address": "schmuergen@example.com"
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 19,
- "hour": 10,
- "minute": 18,
- "second": 3,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "subject": {
- "Text": "Die Hasen und die Frösche"
- },
- "message_id": {
- "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "date"
- },
- {
- "start": 5,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 50,
- "end": 91
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 94,
- "end": 159
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 167,
- "end": 214
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 225,
- "end": 289
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 302,
- "end": 308
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 321,
- "end": 354
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 380,
- "end": 399
- }
- ]
- ],
"html_body": [
0
],
@@ -145,53 +35,135 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "QUOTED-PRINTABLE"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@penguin.example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 321,
- "end": 354
+ "to": {
+ "Address": {
+ "name": "Jürgen Schmürgen",
+ "address": "schmuergen@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 19,
+ "hour": 10,
+ "minute": 18,
+ "second": 3,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "QUOTED-PRINTABLE"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 380,
- "end": 399
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 5,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n",
- "offset_header": 0,
- "offset_body": 401,
- "offset_end": 1212
- }
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 50,
+ "end": 91
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 94,
+ "end": 159
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 167,
+ "end": 214
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 225,
+ "end": 289
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 302,
+ "end": 308
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 321,
+ "end": 354
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 380,
+ "end": 399
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n"
+ },
+ "offset_header": 0,
+ "offset_body": 401,
+ "offset_end": 1212
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 401,
- "offset_end": 1212
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/037.txt b/tests/legacy/037.txt
index 872b18a..36e664d 100644
--- a/tests/legacy/037.txt
+++ b/tests/legacy/037.txt
@@ -51,245 +51,257 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------E7889DDF0F75D34163841C59"
- }
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "message_id": {
- "Text": "392366A7.21929EA7@example.com"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 42,
- "second": 31,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 376
- }
- ]
- ],
"html_body": [
- 0,
- 1
+ 1,
+ 2
],
"text_body": [
- 0,
- 1
+ 1,
+ 2
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "7bit"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 477,
- "end": 508
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 42,
+ "second": 31,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "392366A7.21929EA7@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------E7889DDF0F75D34163841C59"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 534,
- "end": 541
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": " ",
- "offset_header": 464,
- "offset_body": 543,
- "offset_end": 544
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 376
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 378,
+ "offset_end": 2587
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_transfer_encoding": {
- "Text": "base64"
+ {
+ "start": 477,
+ "end": 508
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
+ {
+ "start": 534,
+ "end": 541
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": " "
+ },
+ "offset_header": 464,
+ "offset_body": 543,
+ "offset_end": 546
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 599,
- "end": 634
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 660,
- "end": 669
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 689,
- "end": 725
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 599,
+ "end": 634
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 660,
+ "end": 669
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 689,
+ "end": 725
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -1615,24 +1627,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 586,
- "offset_body": 727,
- "offset_end": 2543
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ ]
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 2585
+ "offset_header": 586,
+ "offset_body": 727,
+ "offset_end": 2545
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/038.txt b/tests/legacy/038.txt
index cd00558..57db828 100644
--- a/tests/legacy/038.txt
+++ b/tests/legacy/038.txt
@@ -17,134 +17,6 @@ A HARE one day ridiculed the short feet and slow pace of the Tortoise, who repli
Slow but steady wins the race.
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 24,
- "second": 11,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- },
- "message_id": {
- "Text": "3923625B.59F0C3AC@example.com"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 338
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 364,
- "end": 371
- }
- ]
- ],
"html_body": [
0
],
@@ -154,53 +26,153 @@ Slow but steady wins the race.
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "7bit"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 338
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 24,
+ "second": 11,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "3923625B.59F0C3AC@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "us-ascii"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 364,
- "end": 371
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r\n",
- "offset_header": 0,
- "offset_body": 373,
- "offset_end": 1133
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 338
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 364,
+ "end": 371
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r\n"
+ },
+ "offset_header": 0,
+ "offset_body": 373,
+ "offset_end": 1133
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 373,
- "offset_end": 1133
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/039.txt b/tests/legacy/039.txt
index 46a13fc..0f21d40 100644
--- a/tests/legacy/039.txt
+++ b/tests/legacy/039.txt
@@ -171,289 +171,308 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------B7133A01A6B323BF00DBC9A7"
- }
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 18,
- "second": 27,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "to": {
- "Address": {
- "name": "Jürgen Schmürgen",
- "address": "schmuergen@example.com"
- }
- },
- "message_id": {
- "Text": "39236103.FFE674FC@example.com"
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 277
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 285,
- "end": 331
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 344,
- "end": 413
- }
- ]
- ],
"html_body": [
- 1,
- 4,
- 5
+ 2,
+ 5,
+ 6
],
"text_body": [
- 1,
- 4,
- 5
+ 2,
+ 5,
+ 6
],
"attachments": [
- 2,
3,
4,
- 5
+ 5,
+ 6
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "related",
- "attributes": {
- "boundary": "------------8E6A06810565BCAB5E1F7D97"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 514,
- "end": 585
+ "to": {
+ "Address": {
+ "name": "Jürgen Schmürgen",
+ "address": "schmuergen@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 18,
+ "second": 27,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "39236103.FFE674FC@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------B7133A01A6B323BF00DBC9A7"
}
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "offset_header": 501,
- "offset_body": 587,
- "offset_end": 6127
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 277
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 285,
+ "end": 331
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 344,
+ "end": 413
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 5,
+ 6
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 415,
+ "offset_end": 10135
},
{
- "Html": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "html",
- "attributes": {
- "charset": "us-ascii"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "related",
+ "attributes": {
+ "boundary": "------------8E6A06810565BCAB5E1F7D97"
}
- },
- "content_transfer_encoding": {
- "Text": "7bit"
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 642,
- "end": 672
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 698,
- "end": 705
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "\r\n\r\n\r\n
Die Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n",
- "offset_header": 629,
- "offset_body": 707,
- "offset_end": 1841
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 514,
+ "end": 585
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 501,
+ "offset_body": 587,
+ "offset_end": 6127
},
{
- "Binary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_id": {
- "Text": "part1.39236103.1B697A54@example.com"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": null
- }
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "C:TEMPnsmailV0.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "html",
+ "attributes": {
+ "charset": "us-ascii"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1896,
- "end": 1908
- }
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 1919,
- "end": 1959
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1985,
- "end": 1994
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 2014,
- "end": 2056
- }
- ]
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 642,
+ "end": 672
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 698,
+ "end": 705
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Html": "\r\n\r\n
\r\n
Die Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n"
+ },
+ "offset_header": 629,
+ "offset_body": 707,
+ "offset_end": 1843
+ },
+ {
+ "headers_rfc": {
+ "content_id": {
+ "Text": "part1.39236103.1B697A54@example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": null
+ }
+ },
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "C:TEMPnsmailV0.png"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1896,
+ "end": 1908
+ }
+ ],
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 1919,
+ "end": 1959
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1985,
+ "end": 1994
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 2014,
+ "end": 2056
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -1779,78 +1798,78 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 1883,
- "offset_body": 2058,
- "offset_end": 3874
- }
+ ]
+ },
+ "offset_header": 1883,
+ "offset_body": 2058,
+ "offset_end": 3876
},
{
- "Binary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": null
- }
- },
- "content_id": {
- "Text": "part2.39236103.1B697A54@example.com"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "C:TEMPnsmailNM.png"
- }
- }
+ "headers_rfc": {
+ "content_id": {
+ "Text": "part2.39236103.1B697A54@example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": null
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 3929,
- "end": 3941
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "C:TEMPnsmailNM.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 3952,
- "end": 3992
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 4018,
- "end": 4027
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 4047,
- "end": 4089
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 3929,
+ "end": 3941
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 3952,
+ "end": 3992
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 4018,
+ "end": 4027
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 4047,
+ "end": 4089
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -3304,68 +3323,68 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 3916,
- "offset_body": 4091,
- "offset_end": 6083
- }
+ ]
+ },
+ "offset_header": 3916,
+ "offset_body": 4091,
+ "offset_end": 6085
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 6182,
- "end": 6218
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 6244,
- "end": 6253
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 6273,
- "end": 6310
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 6182,
+ "end": 6218
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 6244,
+ "end": 6253
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 6273,
+ "end": 6310
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -4664,68 +4683,68 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 6169,
- "offset_body": 6312,
- "offset_end": 8092
- }
+ ]
+ },
+ "offset_header": 6169,
+ "offset_body": 6312,
+ "offset_end": 8094
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 8147,
- "end": 8182
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 8208,
- "end": 8217
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 8237,
- "end": 8273
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 8147,
+ "end": 8182
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 8208,
+ "end": 8217
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 8237,
+ "end": 8273
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -6051,40 +6070,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 8134,
- "offset_body": 8275,
- "offset_end": 10091
- }
- }
- ],
- "structure": {
- "List": [
- {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
- },
- {
- "Part": 3
- }
- ]
]
},
- {
- "Part": 4
- },
- {
- "Part": 5
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 415,
- "offset_end": 10133
+ "offset_header": 8134,
+ "offset_body": 8275,
+ "offset_end": 10093
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/040.txt b/tests/legacy/040.txt
index cb3a9a4..e3aec75 100644
--- a/tests/legacy/040.txt
+++ b/tests/legacy/040.txt
@@ -28,134 +28,6 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere=
, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Jürgen Schmürgen",
- "address": "schmuergen@example.com"
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "message_id": {
- "Text": "39236653.CAA8A090@example.com"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 41,
- "second": 7,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "subject": {
- "Text": "Die Hasen und die Frösche"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 277
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 285,
- "end": 332
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 345,
- "end": 378
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 404,
- "end": 423
- }
- ]
- ],
"html_body": [
0
],
@@ -165,53 +37,153 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere=
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "quoted-printable"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 345,
- "end": 378
+ "to": {
+ "Address": {
+ "name": "Jürgen Schmürgen",
+ "address": "schmuergen@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 41,
+ "second": 7,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "39236653.CAA8A090@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 404,
- "end": 423
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\"\n",
- "offset_header": 0,
- "offset_body": 425,
- "offset_end": 1231
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 277
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 285,
+ "end": 332
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 345,
+ "end": 378
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 404,
+ "end": 423
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\"\n"
+ },
+ "offset_header": 0,
+ "offset_body": 425,
+ "offset_end": 1231
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 425,
- "offset_end": 1231
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/041.txt b/tests/legacy/041.txt
index 6379578..bfe9dd6 100644
--- a/tests/legacy/041.txt
+++ b/tests/legacy/041.txt
@@ -57,237 +57,249 @@ vAAAAABJRU5ErkJggg==
---1463757054-170444605-958746196=:8452--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "message_id": {
- "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "-1463757054-170444605-958746196=:8452"
- }
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@penguin.example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 19,
- "hour": 10,
- "minute": 23,
- "second": 16,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "subject": {
- "Text": "PNG graphic"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "date"
- },
- {
- "start": 5,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 50,
- "end": 91
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 94,
- "end": 150
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 158,
- "end": 172
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 183,
- "end": 247
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 260,
- "end": 266
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 279,
- "end": 347
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "US-ASCII"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "PNG graphic"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@penguin.example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 623,
- "end": 654
+ "to": {
+ "Address": {
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 19,
+ "hour": 10,
+ "minute": 23,
+ "second": 16,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "-1463757054-170444605-958746196=:8452"
}
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 5,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\n",
- "offset_header": 610,
- "offset_body": 656,
- "offset_end": 656
- }
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 50,
+ "end": 91
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 94,
+ "end": 150
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 158,
+ "end": 172
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 183,
+ "end": 247
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 260,
+ "end": 266
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 279,
+ "end": 347
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 349,
+ "offset_end": 3001
},
{
- "Binary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "attachment",
- "c_subtype": null,
- "attributes": {
- "filename": "redball.png"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "US-ASCII"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_description": {
- "Text": "red ball"
- },
- "content_transfer_encoding": {
- "Text": "BASE64"
- },
- "content_id": {
- "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com"
- },
- "content_type": {
- "ContentType": {
- "c_type": "application",
- "c_subtype": "octet-stream",
- "attributes": {
- "name": "redball.png"
- }
+ {
+ "start": 623,
+ "end": 654
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\n"
+ },
+ "offset_header": 610,
+ "offset_body": 656,
+ "offset_end": 658
+ },
+ {
+ "headers_rfc": {
+ "content_description": {
+ "Text": "red ball"
+ },
+ "content_id": {
+ "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "BASE64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "application",
+ "c_subtype": "octet-stream",
+ "attributes": {
+ "name": "redball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 712,
- "end": 759
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "attachment",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "redball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 785,
- "end": 794
- }
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 805,
- "end": 862
- }
- ],
- [
- {
- "Rfc": "content_description"
- },
- {
- "start": 882,
- "end": 893
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 913,
- "end": 950
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 712,
+ "end": 759
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 785,
+ "end": 794
+ }
+ ],
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 805,
+ "end": 862
+ }
+ ],
+ [
+ {
+ "Rfc": "content_description"
+ },
+ {
+ "start": 882,
+ "end": 893
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 913,
+ "end": 950
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -1741,24 +1753,11 @@ vAAAAABJRU5ErkJggg==
66,
96,
130
- ],
- "offset_header": 699,
- "offset_body": 952,
- "offset_end": 2956
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ ]
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 349,
- "offset_end": 2999
+ "offset_header": 699,
+ "offset_body": 952,
+ "offset_end": 2958
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/042.txt b/tests/legacy/042.txt
index 3ab6182..e2823ea 100644
--- a/tests/legacy/042.txt
+++ b/tests/legacy/042.txt
@@ -58,261 +58,260 @@ Birds of a feather flock together.
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------77060D866A66DC8D0921E051"
- }
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 50,
- "second": 4,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "message_id": {
- "Text": "3923686C.99FB5E36@example.com"
- },
- "mime_version": {
- "Text": "1.0"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 376
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "7bit"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 477,
- "end": 508
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 50,
+ "second": 4,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "3923686C.99FB5E36@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------77060D866A66DC8D0921E051"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 534,
- "end": 541
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.",
- "offset_header": 464,
- "offset_body": 543,
- "offset_end": 1310
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 376
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 378,
+ "offset_end": 2370
},
{
- "Text": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "farmerandstork.txt"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_transfer_encoding": {
- "Text": "7bit"
+ {
+ "start": 477,
+ "end": 508
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
},
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii",
- "name": "farmerandstork.txt"
- }
+ {
+ "start": 534,
+ "end": 541
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race."
+ },
+ "offset_header": 464,
+ "offset_body": 543,
+ "offset_end": 1312
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "name": "farmerandstork.txt",
+ "charset": "us-ascii"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1365,
- "end": 1425
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "farmerandstork.txt"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1451,
- "end": 1458
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1478,
- "end": 1520
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n",
- "offset_header": 1352,
- "offset_body": 1522,
- "offset_end": 2326
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ }
+ }
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 2368
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1365,
+ "end": 1425
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1451,
+ "end": 1458
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1478,
+ "end": 1520
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n"
+ },
+ "offset_header": 1352,
+ "offset_body": 1522,
+ "offset_end": 2328
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/043.txt b/tests/legacy/043.txt
index 558865d..a17259b 100644
--- a/tests/legacy/043.txt
+++ b/tests/legacy/043.txt
@@ -61,240 +61,239 @@ als wir."
--------------9D454F23DA86BCD63FA3805F--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "alternative",
- "attributes": {
- "boundary": "------------9D454F23DA86BCD63FA3805F"
- }
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 22,
- "minute": 47,
- "second": 43,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "subject": {
- "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)"
- },
- "message_id": {
- "Text": "392359CF.DFF4527@example.com"
- },
- "to": {
- "Address": {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 44
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 49,
- "end": 83
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 88,
- "end": 125
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 134,
- "end": 164
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 182,
- "end": 187
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 200,
- "end": 206
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 209,
- "end": 265
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 273,
- "end": 348
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 361,
- "end": 436
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 0
+ 1
],
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "quoted-printable"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 493,
- "end": 526
+ "to": {
+ "Address": {
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 22,
+ "minute": 47,
+ "second": 43,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "392359CF.DFF4527@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "alternative",
+ "attributes": {
+ "boundary": "------------9D454F23DA86BCD63FA3805F"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 552,
- "end": 571
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 44
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n",
- "offset_header": 480,
- "offset_body": 573,
- "offset_end": 1371
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 49,
+ "end": 83
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 88,
+ "end": 125
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 134,
+ "end": 164
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 182,
+ "end": 187
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 200,
+ "end": 206
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 209,
+ "end": 265
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 273,
+ "end": 348
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 361,
+ "end": 436
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 438,
+ "offset_end": 2484
},
{
- "Html": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "7bit"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "html",
- "attributes": {
- "charset": "us-ascii"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1426,
- "end": 1456
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1482,
- "end": 1489
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "\r\n\r\nDie Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
\r\n
\r\n",
- "offset_header": 1413,
- "offset_body": 1491,
- "offset_end": 2440
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ }
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 438,
- "offset_end": 2482
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 493,
+ "end": 526
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 552,
+ "end": 571
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
+ },
+ "offset_header": 480,
+ "offset_body": 573,
+ "offset_end": 1373
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "html",
+ "attributes": {
+ "charset": "us-ascii"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1426,
+ "end": 1456
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1482,
+ "end": 1489
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Html": "\r\n\r\nDie Hasen und die Frösche\r\n
Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n
In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n
\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n P`0C `(:P``\r\nM.0``8P`0E `0G `AI0`0I0`AK0!\"O1ACQC%CQCE2QB$IS@`8O0`0K0`8K0`A\r\nMO0\"4UF.MUGN$UE)*WA@AU@`8Q@`8M0``*0!\"SA#.YY3>YZW&YY24YV-2YR$A\r\nMW@`8S@!2WB& P`0C `(:P``\r\nM.0``8P`0E `0G `AI0`0I0`AK0!\"O1ACQC%CQCE2QB$IS@`8O0`0K0`8K0`A\r\nMO0\"4UF.MUGN$UE)*WA@AU@`8Q@`8M0``*0!\"SA#.YY3>YZW&YY24YV-2YR$A\r\nMW@`8S@!2WB& This is what displays in most modern email clients This is what displays in most modern email clients Don't find me here Don't find me here Hello world Hello world
\r\n
\r\n"
+ },
+ "offset_header": 1413,
+ "offset_body": 1491,
+ "offset_end": 2442
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/044.txt b/tests/legacy/044.txt
index 7b203e2..e33a68a 100644
--- a/tests/legacy/044.txt
+++ b/tests/legacy/044.txt
@@ -137,251 +137,265 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
--------------A1FCDEE154E03D875E5D6779--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "message_id": {
- "Text": "39235E1C.1DC7EA90@example.com"
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 6,
- "second": 4,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------A1FCDEE154E03D875E5D6779"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 376
- }
- ]
- ],
"html_body": [
- 0,
1,
2,
- 3
+ 3,
+ 4
],
"text_body": [
- 0,
1,
2,
- 3
+ 3,
+ 4
],
"attachments": [
- 1,
2,
- 3
+ 3,
+ 4
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 477,
- "end": 510
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 6,
+ "second": 4,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "39235E1C.1DC7EA90@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------A1FCDEE154E03D875E5D6779"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 536,
- "end": 555
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n",
- "offset_header": 464,
- "offset_body": 557,
- "offset_end": 1355
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 376
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2,
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 378,
+ "offset_end": 7536
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "redball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "redball.png"
- }
+ {
+ "start": 477,
+ "end": 510
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 536,
+ "end": 555
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
+ },
+ "offset_header": 464,
+ "offset_body": 557,
+ "offset_end": 1357
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "redball.png"
}
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1410,
- "end": 1444
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "redball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1470,
- "end": 1479
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1499,
- "end": 1534
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1410,
+ "end": 1444
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1470,
+ "end": 1479
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1499,
+ "end": 1534
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -1835,68 +1849,68 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 1397,
- "offset_body": 1536,
- "offset_end": 3528
- }
+ ]
+ },
+ "offset_header": 1397,
+ "offset_body": 1536,
+ "offset_end": 3530
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 3583,
- "end": 3619
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 3645,
- "end": 3654
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 3674,
- "end": 3711
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 3583,
+ "end": 3619
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 3645,
+ "end": 3654
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 3674,
+ "end": 3711
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -3195,68 +3209,68 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 3570,
- "offset_body": 3713,
- "offset_end": 5493
- }
+ ]
+ },
+ "offset_header": 3570,
+ "offset_body": 3713,
+ "offset_end": 5495
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 5548,
- "end": 5583
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 5609,
- "end": 5618
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 5638,
- "end": 5674
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 5548,
+ "end": 5583
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 5609,
+ "end": 5618
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 5638,
+ "end": 5674
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
137,
80,
78,
@@ -4582,30 +4596,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 5535,
- "offset_body": 5676,
- "offset_end": 7492
- }
+ ]
+ },
+ "offset_header": 5535,
+ "offset_body": 5676,
+ "offset_end": 7494
}
- ],
- "structure": {
- "List": [
- {
- "Part": 0
- },
- {
- "Part": 1
- },
- {
- "Part": 2
- },
- {
- "Part": 3
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 7534
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/045.txt b/tests/legacy/045.txt
index 987f000..9a4d731 100644
--- a/tests/legacy/045.txt
+++ b/tests/legacy/045.txt
@@ -42,261 +42,260 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo=
---1463757054-891160829-958746372=:8452--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 19,
- "hour": 10,
- "minute": 26,
- "second": 12,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "to": {
- "AddressList": [
- {
- "name": "Joe Blow",
- "address": "blow@example.com"
- },
- {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- ]
- },
- "subject": {
- "Text": "Die Hasen und die Frösche"
- },
- "message_id": {
- "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "-1463757054-891160829-958746372=:8452"
- }
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@penguin.example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "date"
- },
- {
- "start": 5,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 50,
- "end": 91
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 94,
- "end": 185
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 193,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 251,
- "end": 315
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 328,
- "end": 334
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 347,
- "end": 415
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "US-ASCII"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@penguin.example.com"
}
},
- "headers_raw": [
- [
+ "to": {
+ "AddressList": [
{
- "Rfc": "content_type"
+ "name": "Joe Blow",
+ "address": "blow@example.com"
},
{
- "start": 691,
- "end": 722
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
}
]
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 19,
+ "hour": 10,
+ "minute": 26,
+ "second": 12,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "-1463757054-891160829-958746372=:8452"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 5,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\n",
- "offset_header": 678,
- "offset_body": 724,
- "offset_end": 724
- }
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 50,
+ "end": 91
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 94,
+ "end": 185
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 193,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 251,
+ "end": 315
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 328,
+ "end": 334
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 347,
+ "end": 415
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 417,
+ "offset_end": 2170
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1",
- "name": "HasenundFrösche.txt"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "US-ASCII"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_id": {
- "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "attachment",
- "c_subtype": null,
- "attributes": {
- "filename": "HasenundFrösche.txt"
- }
+ {
+ "start": 691,
+ "end": 722
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\n"
+ },
+ "offset_header": 678,
+ "offset_body": 724,
+ "offset_end": 726
+ },
+ {
+ "headers_rfc": {
+ "content_description": {
+ "Text": "Short story in German"
+ },
+ "content_id": {
+ "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com"
+ },
+ "content_transfer_encoding": {
+ "Text": "BASE64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1",
+ "name": "HasenundFrösche.txt"
}
- },
- "content_transfer_encoding": {
- "Text": "BASE64"
- },
- "content_description": {
- "Text": "Short story in German"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 780,
- "end": 856
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "attachment",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "HasenundFrösche.txt"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 882,
- "end": 891
- }
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 902,
- "end": 959
- }
- ],
- [
- {
- "Rfc": "content_description"
- },
- {
- "start": 979,
- "end": 1003
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1023,
- "end": 1083
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\r\r\n\r\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \r\r\n\r\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\r\n\r\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\r\n\r\r\n",
- "offset_header": 767,
- "offset_body": 1085,
- "offset_end": 2125
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ }
+ }
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 417,
- "offset_end": 2168
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 780,
+ "end": 856
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 882,
+ "end": 891
+ }
+ ],
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 902,
+ "end": 959
+ }
+ ],
+ [
+ {
+ "Rfc": "content_description"
+ },
+ {
+ "start": 979,
+ "end": 1003
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1023,
+ "end": 1083
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\r\r\n\r\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \r\r\n\r\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\r\n\r\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\r\n\r\r\n"
+ },
+ "offset_header": 767,
+ "offset_body": 1085,
+ "offset_end": 2127
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/046.txt b/tests/legacy/046.txt
index b4e327d..746eeef 100644
--- a/tests/legacy/046.txt
+++ b/tests/legacy/046.txt
@@ -32,134 +32,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "subject": {
- "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "message_id": {
- "Text": "3923561C.B7078DEF@example.com"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 22,
- "minute": 31,
- "second": 57,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "to": {
- "Address": {
- "name": "Jürgen Schmürgen",
- "address": "schmuergen@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 277
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 285,
- "end": 360
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 373,
- "end": 406
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 432,
- "end": 451
- }
- ]
- ],
"html_body": [
0
],
@@ -169,53 +41,153 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 373,
- "end": 406
+ "to": {
+ "Address": {
+ "name": "Jürgen Schmürgen",
+ "address": "schmuergen@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 22,
+ "minute": 31,
+ "second": 57,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "3923561C.B7078DEF@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 432,
- "end": 451
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n",
- "offset_header": 0,
- "offset_body": 453,
- "offset_end": 1251
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 277
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 285,
+ "end": 360
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 373,
+ "end": 406
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 432,
+ "end": 451
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
+ },
+ "offset_header": 0,
+ "offset_body": 453,
+ "offset_end": 1251
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 453,
- "offset_end": 1251
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/047.txt b/tests/legacy/047.txt
index da194e1..0a07b51 100644
--- a/tests/legacy/047.txt
+++ b/tests/legacy/047.txt
@@ -60,261 +60,260 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere=
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------CA611088711119FBDB3473B4"
- }
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- },
- "message_id": {
- "Text": "392367BC.3D075C95@example.com"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 47,
- "second": 8,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 376
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "7bit"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 477,
- "end": 508
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 47,
+ "second": 8,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "392367BC.3D075C95@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------CA611088711119FBDB3473B4"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 534,
- "end": 541
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.",
- "offset_header": 464,
- "offset_body": 543,
- "offset_end": 1310
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 376
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 378,
+ "offset_end": 2436
},
{
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "quoted-printable"
- },
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1",
- "name": "HasenundFrösche.txt"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "HasenundFrösche.txt"
- }
+ {
+ "start": 477,
+ "end": 508
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 534,
+ "end": 541
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race."
+ },
+ "offset_header": 464,
+ "offset_body": 543,
+ "offset_end": 1312
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "name": "HasenundFrösche.txt",
+ "charset": "iso-8859-1"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1365,
- "end": 1449
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "HasenundFrösche.txt"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1475,
- "end": 1494
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1514,
- "end": 1578
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n",
- "offset_header": 1352,
- "offset_body": 1580,
- "offset_end": 2392
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ }
+ }
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 2434
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1365,
+ "end": 1449
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1475,
+ "end": 1494
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1514,
+ "end": 1578
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
+ },
+ "offset_header": 1352,
+ "offset_body": 1580,
+ "offset_end": 2394
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/048.txt b/tests/legacy/048.txt
index 23ea212..dc80083 100644
--- a/tests/legacy/048.txt
+++ b/tests/legacy/048.txt
@@ -155,251 +155,265 @@ end
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "blow@example.com"
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "------------177483472E7788F4AD46AB1A"
- }
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "message_id": {
- "Text": "3923670C.67D83A99@example.com"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 23,
- "minute": 44,
- "second": 12,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "subject": {
- "Text": "Test message from Netscape Communicator 4.7"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 45
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 50,
- "end": 84
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 89,
- "end": 126
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 135,
- "end": 165
- }
- ],
- [
- {
- "Other": "X-Accept-Language"
- },
- {
- "start": 183,
- "end": 188
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 201,
- "end": 207
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 210,
- "end": 240
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 248,
- "end": 294
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 307,
- "end": 376
- }
- ]
- ],
"html_body": [
- 0,
1,
2,
- 3
+ 3,
+ 4
],
"text_body": [
- 0,
1,
2,
- 3
+ 3,
+ 4
],
"attachments": [
- 1,
2,
- 3
+ 3,
+ 4
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "us-ascii"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "7bit"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Netscape Communicator 4.7"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 477,
- "end": 508
+ "to": {
+ "Address": {
+ "name": "Joe Blow",
+ "address": "blow@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 23,
+ "minute": 44,
+ "second": 12,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "3923670C.67D83A99@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "------------177483472E7788F4AD46AB1A"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 534,
- "end": 541
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 45
+ }
],
- "is_encoding_problem": false,
- "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.",
- "offset_header": 464,
- "offset_body": 543,
- "offset_end": 1310
- }
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 50,
+ "end": 84
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 89,
+ "end": 126
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 135,
+ "end": 165
+ }
+ ],
+ [
+ {
+ "Other": "X-Accept-Language"
+ },
+ {
+ "start": 183,
+ "end": 188
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 201,
+ "end": 207
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 210,
+ "end": 240
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 248,
+ "end": 294
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 307,
+ "end": 376
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2,
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 378,
+ "offset_end": 7718
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "redball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "7bit"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "us-ascii"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_transfer_encoding": {
- "Text": "x-uuencode"
+ {
+ "start": 477,
+ "end": 508
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "redball.png"
- }
+ {
+ "start": 534,
+ "end": 541
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race."
+ },
+ "offset_header": 464,
+ "offset_body": 543,
+ "offset_end": 1312
+ },
+ {
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "x-uuencode"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "redball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1365,
- "end": 1399
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "redball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1425,
- "end": 1438
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1458,
- "end": 1493
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1365,
+ "end": 1399
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1425,
+ "end": 1438
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1458,
+ "end": 1493
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
98,
101,
103,
@@ -2467,68 +2481,68 @@ end
100,
13,
10
- ],
- "offset_header": 1352,
- "offset_body": 1495,
- "offset_end": 3562
- }
+ ]
+ },
+ "offset_header": 1352,
+ "offset_body": 1495,
+ "offset_end": 3564
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "x-uuencode"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "x-uuencode"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 3617,
- "end": 3653
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 3679,
- "end": 3692
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 3712,
- "end": 3749
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 3617,
+ "end": 3653
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 3679,
+ "end": 3692
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 3712,
+ "end": 3749
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
98,
101,
103,
@@ -4378,68 +4392,68 @@ end
100,
13,
10
- ],
- "offset_header": 3604,
- "offset_body": 3751,
- "offset_end": 5600
- }
+ ]
+ },
+ "offset_header": 3604,
+ "offset_body": 3751,
+ "offset_end": 5602
},
{
- "InlineBinary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "x-uuencode"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "x-uuencode"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 5655,
- "end": 5690
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 5716,
- "end": 5729
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 5749,
- "end": 5785
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 5655,
+ "end": 5690
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 5716,
+ "end": 5729
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 5749,
+ "end": 5785
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "InlineBinary": [
98,
101,
103,
@@ -6327,30 +6341,11 @@ end
100,
13,
10
- ],
- "offset_header": 5642,
- "offset_body": 5787,
- "offset_end": 7674
- }
+ ]
+ },
+ "offset_header": 5642,
+ "offset_body": 5787,
+ "offset_end": 7676
}
- ],
- "structure": {
- "List": [
- {
- "Part": 0
- },
- {
- "Part": 1
- },
- {
- "Part": 2
- },
- {
- "Part": 3
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 378,
- "offset_end": 7716
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/049.txt b/tests/legacy/049.txt
index 0580258..63f35db 100644
--- a/tests/legacy/049.txt
+++ b/tests/legacy/049.txt
@@ -131,131 +131,6 @@ M)71%6'1#;VUM96YT`&-L:7 R9VEF('8N,"XV(&)Y(%EV97,@4&EG=65T-G,[
end
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@example.com"
- }
- },
- "to": {
- "Address": {
- "name": "Joe Blow",
- "address": "jblow@example.com"
- }
- },
- "subject": {
- "Text": "Test message from Microsoft Outlook 00"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 19,
- "minute": 58,
- "second": 13,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "message_id": {
- "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "from"
- },
- {
- "start": 5,
- "end": 40
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 43,
- "end": 76
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 84,
- "end": 125
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 130,
- "end": 164
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 175,
- "end": 225
- }
- ],
- [
- {
- "Other": "X-Priority"
- },
- {
- "start": 236,
- "end": 249
- }
- ],
- [
- {
- "Other": "X-MSMail-Priority"
- },
- {
- "start": 267,
- "end": 276
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 285,
- "end": 338
- }
- ],
- [
- {
- "Other": "Importance"
- },
- {
- "start": 349,
- "end": 358
- }
- ],
- [
- {
- "Other": "X-MimeOLE"
- },
- {
- "start": 368,
- "end": 416
- }
- ]
- ],
"html_body": [
0
],
@@ -265,29 +140,138 @@ end
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Test message from Microsoft Outlook 00"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@example.com"
}
},
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": "\r\nThe Hare and the Tortoise\r\n\r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who\r\nreplied, laughing: \"Though you be swift as the wind, I will beat you in a\r\nrace.\" The Hare, believing her assertion to be simply impossible, assented\r\nto the proposal; and they agreed that the Fox should choose the course and\r\nfix the goal. On the day appointed for the race the two started together.\r\nThe Tortoise never for a moment stopped, but went on with a slow but steady\r\npace straight to the end of the course. The Hare, lying down by the\r\nwayside, fell fast asleep. At last waking up, and moving as fast as he\r\ncould, he saw the Tortoise had reached the goal, and was comfortably dozing\r\nafter her fatigue.\r\n\r\nSlow but steady wins the race.\r\n\r\n\r\nbegin 666 blueball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM``@``! ``!@`````\"\"D`$$(`$$H`\"#$`$%(((7,(*7L(*80((6L`&%H`\"#D(\r\nM(6,0.9P80J480JT80K40.:40,90`&%(0,8PI4K4Y8\\8Y8\\XI6LX82LX80LX8\r\nM0KU\":\\9[G-:
\n
\nDie Hasen und die\nFrösche
\n
\nDie Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\n",
- "offset_header": 552,
- "offset_body": 646,
- "offset_end": 1885
- }
+ [
+ {
+ "Other": "X-Sender"
+ },
+ {
+ "start": 73,
+ "end": 113
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 122,
+ "end": 170
+ }
+ ],
+ [
+ {
+ "Other": "X-Priority"
+ },
+ {
+ "start": 181,
+ "end": 192
+ }
+ ],
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 197,
+ "end": 231
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 234,
+ "end": 288
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 293,
+ "end": 330
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 338,
+ "end": 383
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 396,
+ "end": 402
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 415,
+ "end": 508
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 510,
+ "offset_end": 6229
},
{
- "Binary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "2aa658b6.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "html",
+ "attributes": {
+ "charset": "iso-8859-1"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "2aa658b6.png"
- }
+ {
+ "start": 565,
+ "end": 599
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 625,
+ "end": 644
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Html": "\n
\n
\nDie Hasen und die\nFrösche
\n
\nDie Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\n"
+ },
+ "offset_header": 552,
+ "offset_body": 646,
+ "offset_end": 1887
+ },
+ {
+ "headers_rfc": {
+ "content_id": {
+ "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "2aa658b6.png"
}
- },
- "content_id": {
- "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2"
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1942,
- "end": 1975
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "2aa658b6.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 1986,
- "end": 2041
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 2067,
- "end": 2076
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 2096,
- "end": 2130
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1942,
+ "end": 1975
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 1986,
+ "end": 2041
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 2067,
+ "end": 2076
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 2096,
+ "end": 2130
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -1694,80 +1707,80 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
66,
96,
130
- ],
- "offset_header": 1929,
- "offset_body": 2132,
- "offset_end": 3946
- }
+ ]
+ },
+ "offset_header": 1929,
+ "offset_body": 2132,
+ "offset_end": 3948
},
{
- "Binary": {
- "headers_rfc": {
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "2aa658c0.png"
- }
+ "headers_rfc": {
+ "content_id": {
+ "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "2aa658c0.png"
}
- },
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "2aa658c0.png"
- }
- }
- },
- "content_id": {
- "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 4003,
- "end": 4036
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "2aa658c0.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 4047,
- "end": 4102
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 4128,
- "end": 4137
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 4157,
- "end": 4191
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 4003,
+ "end": 4036
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 4047,
+ "end": 4102
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 4128,
+ "end": 4137
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 4157,
+ "end": 4191
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -3221,27 +3234,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
66,
96,
130
- ],
- "offset_header": 3990,
- "offset_body": 4193,
- "offset_end": 6183
- }
+ ]
+ },
+ "offset_header": 3990,
+ "offset_body": 4193,
+ "offset_end": 6185
}
- ],
- "structure": {
- "List": [
- {
- "Part": 0
- },
- {
- "Part": 1
- },
- {
- "Part": 2
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 510,
- "offset_end": 6227
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/051.txt b/tests/legacy/051.txt
index 5c9f856..62807d6 100644
--- a/tests/legacy/051.txt
+++ b/tests/legacy/051.txt
@@ -161,297 +161,316 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "dwsauder@example.com"
- }
- },
- "message_id": {
- "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com"
- },
- "subject": {
- "Text": "Die Hasen und die Frösche"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "=====================_715515186==_"
- }
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 19,
- "hour": 0,
- "minute": 39,
- "second": 5,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 11,
- "end": 64
- }
- ],
- [
- {
- "Other": "X-Sender"
- },
- {
- "start": 73,
- "end": 113
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 122,
- "end": 170
- }
- ],
- [
- {
- "Other": "X-Priority"
- },
- {
- "start": 181,
- "end": 192
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 197,
- "end": 231
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 234,
- "end": 288
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 293,
- "end": 330
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 338,
- "end": 383
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 396,
- "end": 402
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 415,
- "end": 482
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 1
+ 2
],
"attachments": [
- 2,
3,
4,
- 5
+ 5,
+ 6
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "related",
- "attributes": {
- "type": "text/plain",
- "boundary": "=====================_715515186==_.REL"
- }
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "dwsauder@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 535,
- "end": 629
+ "to": {
+ "Address": {
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 19,
+ "hour": 0,
+ "minute": 39,
+ "second": 5,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "=====================_715515186==_"
}
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 11,
+ "end": 64
+ }
],
- "offset_header": 522,
- "offset_body": 631,
- "offset_end": 5945
- }
+ [
+ {
+ "Other": "X-Sender"
+ },
+ {
+ "start": 73,
+ "end": 113
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 122,
+ "end": 170
+ }
+ ],
+ [
+ {
+ "Other": "X-Priority"
+ },
+ {
+ "start": 181,
+ "end": 192
+ }
+ ],
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 197,
+ "end": 231
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 234,
+ "end": 288
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 293,
+ "end": 330
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 338,
+ "end": 383
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 396,
+ "end": 402
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 415,
+ "end": 482
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 5,
+ 6
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 484,
+ "offset_end": 9941
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "iso-8859-1"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "related",
+ "attributes": {
+ "type": "text/plain",
+ "boundary": "=====================_715515186==_.REL"
}
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 686,
- "end": 721
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 747,
- "end": 766
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa5e03a.png2aa5e044.png",
- "offset_header": 673,
- "offset_body": 768,
- "offset_end": 1601
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 535,
+ "end": 629
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 522,
+ "offset_body": 631,
+ "offset_end": 5945
},
{
- "Binary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "2aa5e03a.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "iso-8859-1"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "2aa5e03a.png"
- }
+ {
+ "start": 686,
+ "end": 721
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 747,
+ "end": 766
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa5e03a.png2aa5e044.png"
+ },
+ "offset_header": 673,
+ "offset_body": 768,
+ "offset_end": 1603
+ },
+ {
+ "headers_rfc": {
+ "content_id": {
+ "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "2aa5e03a.png"
}
- },
- "content_id": {
- "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2"
- },
- "content_transfer_encoding": {
- "Text": "base64"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1658,
- "end": 1691
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "2aa5e03a.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 1702,
- "end": 1757
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1783,
- "end": 1792
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 1812,
- "end": 1846
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 1658,
+ "end": 1691
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 1702,
+ "end": 1757
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 1783,
+ "end": 1792
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 1812,
+ "end": 1846
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -1777,80 +1796,80 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 1645,
- "offset_body": 1848,
- "offset_end": 3662
- }
+ ]
+ },
+ "offset_header": 1645,
+ "offset_body": 1848,
+ "offset_end": 3664
},
{
- "Binary": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "2aa5e044.png"
- }
- }
- },
- "content_id": {
- "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "inline",
- "c_subtype": null,
- "attributes": {
- "filename": "2aa5e044.png"
- }
+ "headers_rfc": {
+ "content_id": {
+ "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3"
+ },
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "2aa5e044.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 3719,
- "end": 3752
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "inline",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "2aa5e044.png"
}
- ],
- [
- {
- "Rfc": "content_id"
- },
- {
- "start": 3763,
- "end": 3818
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 3844,
- "end": 3853
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 3873,
- "end": 3907
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 3719,
+ "end": 3752
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_id"
+ },
+ {
+ "start": 3763,
+ "end": 3818
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 3844,
+ "end": 3853
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 3873,
+ "end": 3907
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -3304,68 +3323,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 3706,
- "offset_body": 3909,
- "offset_end": 5899
- }
+ ]
+ },
+ "offset_header": 3706,
+ "offset_body": 3909,
+ "offset_end": 5901
},
{
- "Binary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "blueball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "attachment",
- "c_subtype": null,
- "attributes": {
- "filename": "blueball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "blueball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 5998,
- "end": 6031
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "attachment",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "blueball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 6057,
- "end": 6066
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 6086,
- "end": 6124
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 5998,
+ "end": 6031
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 6057,
+ "end": 6066
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 6086,
+ "end": 6124
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -4691,68 +4710,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 5985,
- "offset_body": 6126,
- "offset_end": 7940
- }
+ ]
+ },
+ "offset_header": 5985,
+ "offset_body": 6126,
+ "offset_end": 7942
},
{
- "Binary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "png",
- "attributes": {
- "name": "greenball.png"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "base64"
- },
- "content_disposition": {
- "ContentType": {
- "c_type": "attachment",
- "c_subtype": null,
- "attributes": {
- "filename": "greenball.png"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "base64"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "image",
+ "c_subtype": "png",
+ "attributes": {
+ "name": "greenball.png"
}
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 7993,
- "end": 8027
+ "content_disposition": {
+ "ContentType": {
+ "c_type": "attachment",
+ "c_subtype": null,
+ "attributes": {
+ "filename": "greenball.png"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 8053,
- "end": 8062
- }
- ],
- [
- {
- "Rfc": "content_disposition"
- },
- {
- "start": 8082,
- "end": 8121
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 7993,
+ "end": 8027
+ }
],
- "is_encoding_problem": false,
- "body": [
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 8053,
+ "end": 8062
+ }
+ ],
+ [
+ {
+ "Rfc": "content_disposition"
+ },
+ {
+ "start": 8082,
+ "end": 8121
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
137,
80,
78,
@@ -6051,40 +6070,11 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
66,
96,
130
- ],
- "offset_header": 7980,
- "offset_body": 8123,
- "offset_end": 9899
- }
- }
- ],
- "structure": {
- "List": [
- {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
- },
- {
- "Part": 3
- }
- ]
]
},
- {
- "Part": 4
- },
- {
- "Part": 5
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 484,
- "offset_end": 9939
+ "offset_header": 7980,
+ "offset_body": 8123,
+ "offset_end": 9901
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/052.txt b/tests/legacy/052.txt
index c8b5b76..50a19bc 100644
--- a/tests/legacy/052.txt
+++ b/tests/legacy/052.txt
@@ -27,131 +27,6 @@ welche also wohl noch ungl
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Heinz M�ller",
- "address": "mueller@example.com"
- }
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 19,
- "minute": 28,
- "second": 40,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "message_id": {
- "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@example.com"
- }
- },
- "subject": {
- "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "from"
- },
- {
- "start": 5,
- "end": 40
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 43,
- "end": 82
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 90,
- "end": 141
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 146,
- "end": 180
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 191,
- "end": 241
- }
- ],
- [
- {
- "Other": "X-Priority"
- },
- {
- "start": 252,
- "end": 265
- }
- ],
- [
- {
- "Other": "X-MSMail-Priority"
- },
- {
- "start": 283,
- "end": 292
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 301,
- "end": 354
- }
- ],
- [
- {
- "Other": "Importance"
- },
- {
- "start": 365,
- "end": 374
- }
- ],
- [
- {
- "Other": "X-MimeOLE"
- },
- {
- "start": 384,
- "end": 432
- }
- ]
- ],
"html_body": [
0
],
@@ -161,29 +36,138 @@ welche also wohl noch ungl
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@example.com"
}
},
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Fr�sche\r\n\r\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod\r\nselbst. Auf, la�t uns ein f�r allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\r\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte\r\neine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\r\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\r\n\r\n",
- "offset_header": 0,
- "offset_body": 434,
- "offset_end": 1186
- }
+ "to": {
+ "Address": {
+ "name": "Heinz M�ller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 19,
+ "minute": 28,
+ "second": 40,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com"
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 5,
+ "end": 40
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 43,
+ "end": 82
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 90,
+ "end": 141
+ }
+ ],
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 146,
+ "end": 180
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 191,
+ "end": 241
+ }
+ ],
+ [
+ {
+ "Other": "X-Priority"
+ },
+ {
+ "start": 252,
+ "end": 265
+ }
+ ],
+ [
+ {
+ "Other": "X-MSMail-Priority"
+ },
+ {
+ "start": 283,
+ "end": 292
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 301,
+ "end": 354
+ }
+ ],
+ [
+ {
+ "Other": "Importance"
+ },
+ {
+ "start": 365,
+ "end": 374
+ }
+ ],
+ [
+ {
+ "Other": "X-MimeOLE"
+ },
+ {
+ "start": 384,
+ "end": 432
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Fr�sche\r\n\r\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod\r\nselbst. Auf, la�t uns ein f�r allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\r\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte\r\neine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\r\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\r\n\r\n"
+ },
+ "offset_header": 0,
+ "offset_body": 434,
+ "offset_end": 1186
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 434,
- "offset_end": 1186
+ ]
}
\ No newline at end of file
diff --git a/tests/legacy/053.txt b/tests/legacy/053.txt
index 2d99bb5..857bd5c 100644
--- a/tests/legacy/053.txt
+++ b/tests/legacy/053.txt
@@ -32,161 +32,6 @@ einige Tiere, welche also wohl noch ungl=C3=BCcklicher sein m=C3=BCssen =
als wir."=20
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Heinz Müller",
- "address": "mueller@example.com"
- }
- },
- "subject": {
- "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
- },
- "date": {
- "DateTime": {
- "year": 2000,
- "month": 5,
- "day": 17,
- "hour": 19,
- "minute": 27,
- "second": 4,
- "tz_before_gmt": true,
- "tz_hour": 4,
- "tz_minute": 0
- }
- },
- "message_id": {
- "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "from": {
- "Address": {
- "name": "Doug Sauder",
- "address": "doug@example.com"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "from"
- },
- {
- "start": 5,
- "end": 40
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 43,
- "end": 97
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 105,
- "end": 177
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 182,
- "end": 216
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 227,
- "end": 277
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 290,
- "end": 296
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 309,
- "end": 341
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 367,
- "end": 386
- }
- ],
- [
- {
- "Other": "X-Priority"
- },
- {
- "start": 397,
- "end": 410
- }
- ],
- [
- {
- "Other": "X-MSMail-Priority"
- },
- {
- "start": 428,
- "end": 437
- }
- ],
- [
- {
- "Other": "X-Mailer"
- },
- {
- "start": 446,
- "end": 499
- }
- ],
- [
- {
- "Other": "Importance"
- },
- {
- "start": 510,
- "end": 519
- }
- ],
- [
- {
- "Other": "X-MimeOLE"
- },
- {
- "start": 529,
- "end": 577
- }
- ]
- ],
"html_body": [
0
],
@@ -196,53 +41,180 @@ als wir."=20
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "utf-8"
- }
- }
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
+ },
+ "from": {
+ "Address": {
+ "name": "Doug Sauder",
+ "address": "doug@example.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 309,
- "end": 341
+ "to": {
+ "Address": {
+ "name": "Heinz Müller",
+ "address": "mueller@example.com"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2000,
+ "month": 5,
+ "day": 17,
+ "hour": 19,
+ "minute": 27,
+ "second": 4,
+ "tz_before_gmt": true,
+ "tz_hour": 4,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": {
+ "charset": "utf-8"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 367,
- "end": 386
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 5,
+ "end": 40
+ }
],
- "is_encoding_problem": false,
- "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n",
- "offset_header": 0,
- "offset_body": 579,
- "offset_end": 1440
- }
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 43,
+ "end": 97
+ }
+ ],
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 105,
+ "end": 177
+ }
+ ],
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 182,
+ "end": 216
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 227,
+ "end": 277
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 290,
+ "end": 296
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 309,
+ "end": 341
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 367,
+ "end": 386
+ }
+ ],
+ [
+ {
+ "Other": "X-Priority"
+ },
+ {
+ "start": 397,
+ "end": 410
+ }
+ ],
+ [
+ {
+ "Other": "X-MSMail-Priority"
+ },
+ {
+ "start": 428,
+ "end": 437
+ }
+ ],
+ [
+ {
+ "Other": "X-Mailer"
+ },
+ {
+ "start": 446,
+ "end": 499
+ }
+ ],
+ [
+ {
+ "Other": "Importance"
+ },
+ {
+ "start": 510,
+ "end": 519
+ }
+ ],
+ [
+ {
+ "Other": "X-MimeOLE"
+ },
+ {
+ "start": 529,
+ "end": 577
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n"
+ },
+ "offset_header": 0,
+ "offset_body": 579,
+ "offset_end": 1440
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 579,
- "offset_end": 1440
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/000.txt b/tests/malformed/000.txt
index aa4890b..28481b5 100644
--- a/tests/malformed/000.txt
+++ b/tests/malformed/000.txt
@@ -10,36 +10,40 @@ Content-Type: text/html
--:foo--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": ":foo"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 47
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [],
- "parts": [],
- "structure": {
- "List": []
- },
- "offset_header": 0,
- "offset_body": 48,
- "offset_end": 160
+ "parts": [
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": ":foo"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 47
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": []
+ },
+ "offset_header": 0,
+ "offset_body": 48,
+ "offset_end": 160
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/001.txt b/tests/malformed/001.txt
index c43a6ec..facfa21 100644
--- a/tests/malformed/001.txt
+++ b/tests/malformed/001.txt
@@ -10,96 +10,110 @@ Content-Type: text/plain
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "ab"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 45
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 1
+ 2
],
"attachments": [],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "ab"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 64,
- "end": 95
- }
- ]
- ],
- "offset_header": 51,
- "offset_body": 96,
- "offset_end": 132
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 45
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 46,
+ "offset_end": 132
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": "Content-Type: text/plain\n",
- "offset_header": 99,
- "offset_body": 101,
- "offset_end": 126
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 46,
- "offset_end": 132
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 64,
+ "end": 95
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 51,
+ "offset_body": 96,
+ "offset_end": 132
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "Content-Type: text/plain\n"
+ },
+ "offset_header": 99,
+ "offset_body": 101,
+ "offset_end": 127
+ },
+ {
+ "headers_rfc": {},
+ "headers_raw": [],
+ "is_encoding_problem": true,
+ "body": {
+ "Binary": []
+ },
+ "offset_header": 131,
+ "offset_body": 132,
+ "offset_end": 132
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/002.txt b/tests/malformed/002.txt
index c180148..22c09e0 100644
--- a/tests/malformed/002.txt
+++ b/tests/malformed/002.txt
@@ -3,18 +3,6 @@ Content-Type: multipart/mixed; boundary="ab"
body
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 45
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
@@ -22,41 +10,35 @@ body
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "ab"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "ab"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 45
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "body\n",
- "offset_header": 0,
- "offset_body": 46,
- "offset_end": 51
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 45
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "body\n"
+ },
+ "offset_header": 0,
+ "offset_body": 46,
+ "offset_end": 51
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 46,
- "offset_end": 51
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/003.txt b/tests/malformed/003.txt
index be84c54..02afba7 100644
--- a/tests/malformed/003.txt
+++ b/tests/malformed/003.txt
@@ -9,104 +9,106 @@ Content-Type: text/plain
body
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 93
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 94,
- "offset_end": 129
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 129
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 111,
- "end": 123
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "body\n",
- "offset_header": 98,
- "offset_body": 124,
- "offset_end": 125
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 129
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 93
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 94,
+ "offset_end": 129
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 111,
+ "end": 123
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "body\n"
+ },
+ "offset_header": 98,
+ "offset_body": 124,
+ "offset_end": 126
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/004.txt b/tests/malformed/004.txt
index 9c6baf5..98ec6c6 100644
--- a/tests/malformed/004.txt
+++ b/tests/malformed/004.txt
@@ -9,58 +9,63 @@ Content-Type: text/plain
body
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 0
+ 1
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [],
- "is_encoding_problem": true,
- "body": "Content-Type: multipart/mixed; boundary=\"a\"\n\n--ac\nContent-Type: text/plain\n\nbody\n",
- "offset_header": 48,
- "offset_body": 50,
- "offset_end": 127
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 131
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "Content-Type: multipart/mixed; boundary=\"a\"\n\n--ac\nContent-Type: text/plain\n\nbody\n"
+ },
+ "offset_header": 48,
+ "offset_body": 50,
+ "offset_end": 128
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 131
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/005.txt b/tests/malformed/005.txt
index deafbc0..a17c704 100644
--- a/tests/malformed/005.txt
+++ b/tests/malformed/005.txt
@@ -13,106 +13,108 @@ Content-Type: text/html
body2
--a----
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a--"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 46
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 1
+ 2
],
"attachments": [],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a----"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a--"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 66,
- "end": 101
- }
- ]
- ],
- "offset_header": 53,
- "offset_body": 102,
- "offset_end": 151
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 46
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 47,
+ "offset_end": 189
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a----"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 123,
- "end": 135
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "body",
- "offset_header": 110,
- "offset_body": 136,
- "offset_end": 140
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 47,
- "offset_end": 189
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 66,
+ "end": 101
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 53,
+ "offset_body": 102,
+ "offset_end": 151
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 123,
+ "end": 135
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "body"
+ },
+ "offset_header": 110,
+ "offset_body": 136,
+ "offset_end": 141
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/006.txt b/tests/malformed/006.txt
index 56d0b44..4238226 100644
--- a/tests/malformed/006.txt
+++ b/tests/malformed/006.txt
@@ -9,104 +9,106 @@ Content-Type: text/plain
body
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "ab"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 94
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 95,
- "offset_end": 131
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 131
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "ab"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 113,
- "end": 125
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "body\n",
- "offset_header": 100,
- "offset_body": 126,
- "offset_end": 126
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 131
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 94
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 95,
+ "offset_end": 131
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 113,
+ "end": 125
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "body\n"
+ },
+ "offset_header": 100,
+ "offset_body": 126,
+ "offset_end": 127
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/007.txt b/tests/malformed/007.txt
index fc10166..90287d6 100644
--- a/tests/malformed/007.txt
+++ b/tests/malformed/007.txt
@@ -11,106 +11,108 @@ Content-Type: text/plain
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "ab"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 94
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 107,
- "end": 112
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 117,
- "offset_end": 157
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 157
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "ab"
}
}
- },
- "headers_raw": [],
- "is_encoding_problem": true,
- "body": "--a--\n\n",
- "offset_header": 147,
- "offset_body": 150,
- "offset_end": 152
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 157
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 94
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 107,
+ "end": 112
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 117,
+ "offset_end": 157
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "--a--\n\n"
+ },
+ "offset_header": 147,
+ "offset_body": 150,
+ "offset_end": 153
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/008.txt b/tests/malformed/008.txt
index c94c087..4df16d4 100644
--- a/tests/malformed/008.txt
+++ b/tests/malformed/008.txt
@@ -13,104 +13,106 @@ Content-Type: text/html
body2
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "ab"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 45
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "a"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "ab"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 64,
- "end": 95
- }
- ]
- ],
- "offset_header": 51,
- "offset_body": 96,
- "offset_end": 167
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 45
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 46,
+ "offset_end": 167
},
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "a"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 113,
- "end": 125
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "body\n--ab\nContent-Type: text/html\n\nbody2\n",
- "offset_header": 100,
- "offset_body": 126,
- "offset_end": 163
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 46,
- "offset_end": 167
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 64,
+ "end": 95
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 51,
+ "offset_body": 96,
+ "offset_end": 167
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 113,
+ "end": 125
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "body\n--ab\nContent-Type: text/html\n\nbody2\n"
+ },
+ "offset_header": 100,
+ "offset_body": 126,
+ "offset_end": 164
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/009.txt b/tests/malformed/009.txt
index f7adb57..ff927f0 100644
--- a/tests/malformed/009.txt
+++ b/tests/malformed/009.txt
@@ -17,140 +17,140 @@ Content-Type: text/plain
333
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 1
+ 2
],
"attachments": [
- 2
+ 3
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "2"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 93
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 94,
- "offset_end": 193
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 111,
- "end": 123
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "1",
- "offset_header": 98,
- "offset_body": 124,
- "offset_end": 125
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 143,
- "end": 155
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "22\n--1\nContent-Type: text/plain\n\n333\n",
- "offset_header": 130,
- "offset_body": 156,
- "offset_end": 189
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 193
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 193
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "2"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 93
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 94,
+ "offset_end": 193
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 111,
+ "end": 123
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "1"
+ },
+ "offset_header": 98,
+ "offset_body": 124,
+ "offset_end": 126
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 143,
+ "end": 155
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "22\n--1\nContent-Type: text/plain\n\n333\n"
+ },
+ "offset_header": 130,
+ "offset_body": 156,
+ "offset_end": 190
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/010.txt b/tests/malformed/010.txt
index 53f1bdf..eefa87c 100644
--- a/tests/malformed/010.txt
+++ b/tests/malformed/010.txt
@@ -7,26 +7,6 @@ Content-Type: text/plain
1
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 29
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
@@ -34,39 +14,29 @@ Content-Type: text/plain
],
"parts": [
{
- "Message": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "message",
+ "c_subtype": "rfc822",
+ "attributes": null
}
- },
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
- }
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 43,
- "end": 59
- }
- ]
- ],
+ {
+ "start": 13,
+ "end": 29
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Message": {
"html_body": [],
"text_body": [],
"attachments": [
@@ -74,31 +44,18 @@ Content-Type: text/plain
],
"parts": [
{
- "Message": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "message",
+ "c_subtype": "rfc822",
+ "attributes": null
}
- },
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": {
- "headers_rfc": {},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 73,
- "end": 85
- }
- ]
- ],
+ }
+ },
+ "is_encoding_problem": false,
+ "body": {
+ "Message": {
"html_body": [
0
],
@@ -108,65 +65,36 @@ Content-Type: text/plain
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 73,
- "end": 85
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "1\n",
- "offset_header": 60,
- "offset_body": 86,
- "offset_end": 88
- }
+ }
+ },
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "1\n"
+ },
+ "offset_header": 60,
+ "offset_body": 86,
+ "offset_end": 88
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 60,
- "offset_body": 86,
- "offset_end": 88
- },
- "offset_header": 30,
- "offset_body": 60,
- "offset_end": 88
- }
+ ]
+ }
+ },
+ "offset_header": 30,
+ "offset_body": 60,
+ "offset_end": 88
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 30,
- "offset_body": 60,
- "offset_end": 88
- },
- "offset_header": 0,
- "offset_body": 30,
- "offset_end": 88
- }
+ ]
+ }
+ },
+ "offset_header": 0,
+ "offset_body": 30,
+ "offset_end": 88
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 30,
- "offset_end": 88
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/011.txt b/tests/malformed/011.txt
index f7adb57..ff927f0 100644
--- a/tests/malformed/011.txt
+++ b/tests/malformed/011.txt
@@ -17,140 +17,140 @@ Content-Type: text/plain
333
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [
- 1
+ 2
],
"text_body": [
- 1
+ 2
],
"attachments": [
- 2
+ 3
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "2"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 93
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 94,
- "offset_end": 193
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 111,
- "end": 123
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "1",
- "offset_header": 98,
- "offset_body": 124,
- "offset_end": 125
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 143,
- "end": 155
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "22\n--1\nContent-Type: text/plain\n\n333\n",
- "offset_header": 130,
- "offset_body": 156,
- "offset_end": 189
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 193
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 193
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "2"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 93
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 94,
+ "offset_end": 193
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 111,
+ "end": 123
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "1"
+ },
+ "offset_header": 98,
+ "offset_body": 124,
+ "offset_end": 126
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 143,
+ "end": 155
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "22\n--1\nContent-Type: text/plain\n\n333\n"
+ },
+ "offset_header": 130,
+ "offset_body": 156,
+ "offset_end": 190
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/012.txt b/tests/malformed/012.txt
index 25d821b..5075388 100644
--- a/tests/malformed/012.txt
+++ b/tests/malformed/012.txt
@@ -23,100 +23,104 @@ Content-Type: text/plain
333
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [],
"text_body": [],
"attachments": [
- 1,
- 2
+ 2,
+ 3
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "2"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 93
- }
- ]
- ],
- "offset_header": 49,
- "offset_body": 94,
- "offset_end": 283
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 283
},
{
- "Message": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "2"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 111,
- "end": 127
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": {
- "headers_rfc": {},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 141,
- "end": 153
- }
- ]
- ],
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 93
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2,
+ 3
+ ]
+ },
+ "offset_header": 49,
+ "offset_body": 94,
+ "offset_end": 283
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "message",
+ "c_subtype": "rfc822",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 111,
+ "end": 127
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Message": {
"html_body": [
0
],
@@ -126,83 +130,54 @@ Content-Type: text/plain
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 141,
- "end": 153
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "1",
- "offset_header": 128,
- "offset_body": 154,
- "offset_end": 155
- }
- }
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 128,
- "offset_body": 154,
- "offset_end": 155
- },
- "offset_header": 98,
- "offset_body": 128,
- "offset_end": 155
- }
- },
- {
- "Message": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "message",
- "c_subtype": "rfc822",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 173,
- "end": 189
+ }
+ },
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "1"
+ },
+ "offset_header": 128,
+ "offset_body": 154,
+ "offset_end": 156
}
]
- ],
- "is_encoding_problem": false,
- "body": {
- "headers_rfc": {},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 203,
- "end": 215
- }
- ]
- ],
+ }
+ },
+ "offset_header": 98,
+ "offset_body": 128,
+ "offset_end": 156
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "message",
+ "c_subtype": "rfc822",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 173,
+ "end": 189
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Message": {
"html_body": [],
"text_body": [],
"attachments": [
@@ -210,62 +185,29 @@ Content-Type: text/plain
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 203,
- "end": 215
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "22\n--1\nContent-Type: message/rfc822\n\nContent-Type: text/plain\n\n333\n",
- "offset_header": 190,
- "offset_body": 216,
- "offset_end": 279
- }
+ }
+ },
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "22\n--1\nContent-Type: message/rfc822\n\nContent-Type: text/plain\n\n333\n"
+ },
+ "offset_header": 190,
+ "offset_body": 216,
+ "offset_end": 280
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 190,
- "offset_body": 216,
- "offset_end": 279
- },
- "offset_header": 160,
- "offset_body": 190,
- "offset_end": 279
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "Part": 1
- },
- {
- "Part": 2
+ ]
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 283
+ },
+ "offset_header": 160,
+ "offset_body": 190,
+ "offset_end": 280
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/013.txt b/tests/malformed/013.txt
index b59a46a..ff96f17 100644
--- a/tests/malformed/013.txt
+++ b/tests/malformed/013.txt
@@ -32,329 +32,315 @@ hello, world
--1
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "mime_version": {
- "Text": "1.0"
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 57,
- "end": 62
- }
- ]
- ],
"html_body": [
- 0,
- 2,
- 4,
- 6
+ 1,
+ 3,
+ 5,
+ 7
],
"text_body": [
- 0,
- 2,
- 4,
- 6
+ 1,
+ 3,
+ 5,
+ 7
],
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 80,
- "end": 92
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "hello, world",
- "offset_header": 67,
- "offset_body": 93,
- "offset_end": 105
- }
- },
- {
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- },
- "mime_version": {
- "Text": "2.0"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 123,
- "end": 154
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 167,
- "end": 172
- }
- ]
- ],
- "offset_header": 110,
- "offset_body": 173,
- "offset_end": 436
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 190,
- "end": 202
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "hello, world",
- "offset_header": 177,
- "offset_body": 203,
- "offset_end": 215
- }
- },
- {
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- },
- "mime_version": {
- "Text": "abc"
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 233,
- "end": 264
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 277,
- "end": 282
- }
- ]
- ],
- "offset_header": 220,
- "offset_body": 283,
- "offset_end": 436
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 300,
- "end": 312
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "hello, world",
- "offset_header": 287,
- "offset_body": 313,
- "offset_end": 325
- }
- },
- {
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 343,
- "end": 374
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 387,
- "end": 388
- }
- ]
- ],
- "offset_header": 330,
- "offset_body": 389,
- "offset_end": 436
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 406,
- "end": 418
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "hello, world",
- "offset_header": 393,
- "offset_body": 419,
- "offset_end": 431
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ }
},
- {
- "MultiPart": [
- 1,
- [
- {
- "Part": 2
- },
- {
- "MultiPart": [
- 3,
- [
- {
- "Part": 4
- },
- {
- "MultiPart": [
- 5,
- [
- {
- "Part": 6
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 57,
+ "end": 62
+ }
]
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 63,
- "offset_end": 436
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 63,
+ "offset_end": 436
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 80,
+ "end": 92
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "hello, world"
+ },
+ "offset_header": 67,
+ "offset_body": 93,
+ "offset_end": 106
+ },
+ {
+ "headers_rfc": {
+ "mime_version": {
+ "Text": "2.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 123,
+ "end": 154
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 167,
+ "end": 172
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 110,
+ "offset_body": 173,
+ "offset_end": 436
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 190,
+ "end": 202
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "hello, world"
+ },
+ "offset_header": 177,
+ "offset_body": 203,
+ "offset_end": 216
+ },
+ {
+ "headers_rfc": {
+ "mime_version": {
+ "Text": "abc"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 233,
+ "end": 264
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 277,
+ "end": 282
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 5,
+ 6
+ ]
+ },
+ "offset_header": 220,
+ "offset_body": 283,
+ "offset_end": 436
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 300,
+ "end": 312
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "hello, world"
+ },
+ "offset_header": 287,
+ "offset_body": 313,
+ "offset_end": 326
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 343,
+ "end": 374
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 387,
+ "end": 388
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 7
+ ]
+ },
+ "offset_header": 330,
+ "offset_body": 389,
+ "offset_end": 436
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 406,
+ "end": 418
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "hello, world"
+ },
+ "offset_header": 393,
+ "offset_body": 419,
+ "offset_end": 432
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/014.txt b/tests/malformed/014.txt
index 54071f1..9655999 100644
--- a/tests/malformed/014.txt
+++ b/tests/malformed/014.txt
@@ -7,70 +7,75 @@ hello, world
--1
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 44
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 62,
- "end": 74
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "hello, world",
- "offset_header": 49,
- "offset_body": 75,
- "offset_end": 87
- }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 44
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 45,
+ "offset_end": 92
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 62,
+ "end": 74
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "hello, world"
+ },
+ "offset_header": 49,
+ "offset_body": 75,
+ "offset_end": 88
}
- ],
- "structure": {
- "Part": 0
- },
- "offset_header": 0,
- "offset_body": 45,
- "offset_end": 92
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/015.txt b/tests/malformed/015.txt
index 48421e3..7143902 100644
--- a/tests/malformed/015.txt
+++ b/tests/malformed/015.txt
@@ -25,207 +25,219 @@ invalid
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "subject": {
- "Text": "Hello world"
- },
- "message_id": {
- "Text": "1.2.3.4@example"
- },
- "to": {
- "Address": {
- "name": "Another User",
- "address": "test2@example.org"
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "signed",
- "attributes": {
- "micalg": "pgp-sha1",
- "boundary": "=-GNQXLhuj24Pl1aCkk4/d",
- "protocol": "application/pgp-signature"
- }
- }
- },
- "mime_version": {
- "Text": "1.0"
- },
- "return_path": {
- "Text": "test@example.org"
- },
- "date": {
- "DateTime": {
- "year": 2007,
- "month": 5,
- "day": 23,
- "hour": 4,
- "minute": 58,
- "second": 8,
- "tz_before_gmt": false,
- "tz_hour": 3,
- "tz_minute": 0
- }
- },
- "from": {
- "Address": {
- "name": "Test User",
- "address": "test@example.org"
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "return_path"
- },
- {
- "start": 12,
- "end": 32
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 40,
- "end": 53
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 58,
- "end": 88
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 91,
- "end": 125
- }
- ],
- [
- {
- "Rfc": "message_id"
- },
- {
- "start": 136,
- "end": 155
- }
- ],
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 168,
- "end": 173
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 178,
- "end": 211
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 224,
- "end": 334
- }
- ]
- ],
"html_body": [
- 0
+ 1
],
"text_body": [
- 0
+ 1
],
"attachments": [
- 1
+ 2
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- },
- "content_transfer_encoding": {
- "Text": "quoted-printable"
+ "headers_rfc": {
+ "subject": {
+ "Text": "Hello world"
+ },
+ "from": {
+ "Address": {
+ "name": "Test User",
+ "address": "test@example.org"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 373,
- "end": 385
+ "to": {
+ "Address": {
+ "name": "Another User",
+ "address": "test2@example.org"
+ }
+ },
+ "date": {
+ "DateTime": {
+ "year": 2007,
+ "month": 5,
+ "day": 23,
+ "hour": 4,
+ "minute": 58,
+ "second": 8,
+ "tz_before_gmt": false,
+ "tz_hour": 3,
+ "tz_minute": 0
+ }
+ },
+ "message_id": {
+ "Text": "1.2.3.4@example"
+ },
+ "return_path": {
+ "Text": "test@example.org"
+ },
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "signed",
+ "attributes": {
+ "protocol": "application/pgp-signature",
+ "boundary": "=-GNQXLhuj24Pl1aCkk4/d",
+ "micalg": "pgp-sha1"
}
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 411,
- "end": 429
- }
- ]
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "return_path"
+ },
+ {
+ "start": 12,
+ "end": 32
+ }
],
- "is_encoding_problem": false,
- "body": "There was a day \na happy day\n",
- "offset_header": 360,
- "offset_body": 430,
- "offset_end": 463
- }
+ [
+ {
+ "Rfc": "subject"
+ },
+ {
+ "start": 40,
+ "end": 53
+ }
+ ],
+ [
+ {
+ "Rfc": "from"
+ },
+ {
+ "start": 58,
+ "end": 88
+ }
+ ],
+ [
+ {
+ "Rfc": "to"
+ },
+ {
+ "start": 91,
+ "end": 125
+ }
+ ],
+ [
+ {
+ "Rfc": "message_id"
+ },
+ {
+ "start": 136,
+ "end": 155
+ }
+ ],
+ [
+ {
+ "Rfc": "mime_version"
+ },
+ {
+ "start": 168,
+ "end": 173
+ }
+ ],
+ [
+ {
+ "Rfc": "date"
+ },
+ {
+ "start": 178,
+ "end": 211
+ }
+ ],
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 224,
+ "end": 334
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1,
+ 2
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 335,
+ "offset_end": 586
},
{
- "Binary": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "application",
- "c_subtype": "pgp-signature",
- "attributes": {
- "name": "signature.asc"
- }
+ "headers_rfc": {
+ "content_transfer_encoding": {
+ "Text": "quoted-printable"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 373,
+ "end": 385
+ }
+ ],
+ [
+ {
+ "Rfc": "content_transfer_encoding"
+ },
+ {
+ "start": 411,
+ "end": 429
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "There was a day \na happy day\n"
+ },
+ "offset_header": 360,
+ "offset_body": 430,
+ "offset_end": 464
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "application",
+ "c_subtype": "pgp-signature",
+ "attributes": {
+ "name": "signature.asc"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 502,
- "end": 549
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": [
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 502,
+ "end": 549
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Binary": [
105,
110,
118,
@@ -234,24 +246,11 @@ invalid
105,
100,
10
- ],
- "offset_header": 489,
- "offset_body": 550,
- "offset_end": 558
- }
- }
- ],
- "structure": {
- "List": [
- {
- "Part": 0
+ ]
},
- {
- "Part": 1
- }
- ]
- },
- "offset_header": 0,
- "offset_body": 335,
- "offset_end": 585
+ "offset_header": 489,
+ "offset_body": 550,
+ "offset_end": 559
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/malformed/016.txt b/tests/malformed/016.txt
index 52f344b..9fbd591 100644
--- a/tests/malformed/016.txt
+++ b/tests/malformed/016.txt
@@ -24,176 +24,173 @@ Content-Type: text/plain
4444
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 13,
- "end": 125
- }
- ]
- ],
"html_body": [
- 2
+ 3
],
"text_body": [
- 2
+ 3
],
"attachments": [
- 3
+ 4
],
"parts": [
{
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "123456789012345678901234567890123456789012345678901234567890123456789012345678901"
- }
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012"
}
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 224,
- "end": 335
- }
- ]
- ],
- "offset_header": 211,
- "offset_body": 336,
- "offset_end": 997
- }
- },
- {
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
- }
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 433,
- "end": 543
- }
- ]
- ],
- "offset_header": 420,
- "offset_body": 544,
- "offset_end": 997
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 640,
- "end": 652
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "1\n--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\nContent-Type: text/plain\n\n22\n--123456789012345678901234567890123456789012345678901234567890123456789012345678901\nContent-Type: text/plain\n\n333",
- "offset_header": 627,
- "offset_body": 653,
- "offset_end": 882
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 979,
- "end": 991
- }
- ]
- ],
- "is_encoding_problem": true,
- "body": "4444\n",
- "offset_header": 966,
- "offset_body": 992,
- "offset_end": 914
- }
- }
- ],
- "structure": {
- "MultiPart": [
- 0,
- [
- {
- "MultiPart": [
- 1,
- [
- {
- "Part": 2
- },
- {
- "Part": 3
- }
- ]
- ]
}
- ]
- ]
- },
- "offset_header": 0,
- "offset_body": 126,
- "offset_end": 997
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 13,
+ "end": 125
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 1
+ ]
+ },
+ "offset_header": 0,
+ "offset_body": 126,
+ "offset_end": 997
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "123456789012345678901234567890123456789012345678901234567890123456789012345678901"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 224,
+ "end": 335
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 2
+ ]
+ },
+ "offset_header": 211,
+ "offset_body": 336,
+ "offset_end": 997
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
+ }
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 433,
+ "end": 543
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Multipart": [
+ 3,
+ 4
+ ]
+ },
+ "offset_header": 420,
+ "offset_body": 544,
+ "offset_end": 997
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 640,
+ "end": 652
+ }
+ ]
+ ],
+ "is_encoding_problem": false,
+ "body": {
+ "Text": "1\n--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\nContent-Type: text/plain\n\n22\n--123456789012345678901234567890123456789012345678901234567890123456789012345678901\nContent-Type: text/plain\n\n333"
+ },
+ "offset_header": 627,
+ "offset_body": 653,
+ "offset_end": 883
+ },
+ {
+ "headers_rfc": {
+ "content_type": {
+ "ContentType": {
+ "c_type": "text",
+ "c_subtype": "plain",
+ "attributes": null
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "content_type"
+ },
+ {
+ "start": 979,
+ "end": 991
+ }
+ ]
+ ],
+ "is_encoding_problem": true,
+ "body": {
+ "Text": "4444\n"
+ },
+ "offset_header": 966,
+ "offset_body": 992,
+ "offset_end": 915
+ }
+ ]
}
\ No newline at end of file
diff --git a/tests/rfc/000.txt b/tests/rfc/000.txt
index 70bdb21..91fabf4 100644
--- a/tests/rfc/000.txt
+++ b/tests/rfc/000.txt
@@ -72,397 +72,353 @@ Content-Transfer-Encoding: Quoted-printable
--unique-boundary-1--
---- EXPECTED STRUCTURE ----{
- "headers_rfc": {
- "to": {
- "Address": {
- "name": "Ned Freed",
- "address": "ned@innosoft.com"
- }
- },
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "mixed",
- "attributes": {
- "boundary": "unique-boundary-1"
- }
- }
- },
- "from": {
- "Address": {
- "name": "Nathaniel Borenstein",
- "address": "nsb@nsb.fv.com"
- }
- },
- "subject": {
- "Text": "A multipart example"
- },
- "mime_version": {
- "Text": "1.0"
- },
- "date": {
- "DateTime": {
- "year": 1994,
- "month": 10,
- "day": 7,
- "hour": 16,
- "minute": 15,
- "second": 5,
- "tz_before_gmt": true,
- "tz_hour": 7,
- "tz_minute": 0
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "mime_version"
- },
- {
- "start": 13,
- "end": 18
- }
- ],
- [
- {
- "Rfc": "from"
- },
- {
- "start": 23,
- "end": 62
- }
- ],
- [
- {
- "Rfc": "to"
- },
- {
- "start": 65,
- "end": 95
- }
- ],
- [
- {
- "Rfc": "date"
- },
- {
- "start": 100,
- "end": 139
- }
- ],
- [
- {
- "Rfc": "subject"
- },
- {
- "start": 147,
- "end": 168
- }
- ],
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 181,
- "end": 238
- }
- ]
- ],
"html_body": [
- 0,
- 1
+ 1,
+ 2
],
"text_body": [
- 0,
- 1
+ 1,
+ 2
],
"attachments": [
- 3,
4,
5,
- 6
+ 6,
+ 7
],
"parts": [
{
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": null
- }
+ "headers_rfc": {
+ "subject": {
+ "Text": "A multipart example"
+ },
+ "from": {
+ "Address": {
+ "name": "Nathaniel Borenstein",
+ "address": "nsb@nsb.fv.com"
}
},
- "headers_raw": [],
- "is_encoding_problem": false,
- "body": "... Some text appears here ...\n\n[Note that the blank between the boundary and the start\nof the text in this part means no header fields were\ngiven and this is text in the US-ASCII character set.\nIt could have been done with explicit typing as in the\nnext part.]\n",
- "offset_header": 530,
- "offset_body": 531,
- "offset_end": 793
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "plain",
- "attributes": {
- "charset": "US-ASCII"
- }
- }
+ "to": {
+ "Address": {
+ "name": "Ned Freed",
+ "address": "ned@innosoft.com"
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 827,
- "end": 857
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing of body\nparts.\n",
- "offset_header": 814,
- "offset_body": 858,
- "offset_end": 969
- }
- },
- {
- "Multipart": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "multipart",
- "c_subtype": "parallel",
- "attributes": {
- "boundary": "unique-boundary-2"
- }
- }
+ "date": {
+ "DateTime": {
+ "year": 1994,
+ "month": 10,
+ "day": 7,
+ "hour": 16,
+ "minute": 15,
+ "second": 5,
+ "tz_before_gmt": true,
+ "tz_hour": 7,
+ "tz_minute": 0
}
},
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1003,
- "end": 1051
- }
- ]
- ],
- "offset_header": 990,
- "offset_body": 1052,
- "offset_end": 1366
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "audio",
- "c_subtype": "basic",
- "attributes": null
+ "mime_version": {
+ "Text": "1.0"
+ },
+ "content_type": {
+ "ContentType": {
+ "c_type": "multipart",
+ "c_subtype": "mixed",
+ "attributes": {
+ "boundary": "unique-boundary-1"
}
+ }
+ }
+ },
+ "headers_raw": [
+ [
+ {
+ "Rfc": "mime_version"
},
- "content_transfer_encoding": {
- "Text": "base64"
+ {
+ "start": 13,
+ "end": 18
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1085,
- "end": 1098
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1124,
- "end": 1132
- }
- ]
],
- "is_encoding_problem": true,
- "body": "... base64-encoded 8000 Hz single-channel\n mu-law-format audio data goes here ...\n",
- "offset_header": 1072,
- "offset_body": 1133,
- "offset_end": 1218
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_transfer_encoding": {
- "Text": "base64"
+ [
+ {
+ "Rfc": "from"
},
- "content_type": {
- "ContentType": {
- "c_type": "image",
- "c_subtype": "jpeg",
- "attributes": null
- }
+ {
+ "start": 23,
+ "end": 62
}
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1252,
- "end": 1264
- }
- ],
- [
- {
- "Rfc": "content_transfer_encoding"
- },
- {
- "start": 1290,
- "end": 1298
- }
- ]
],
- "is_encoding_problem": true,
- "body": "... base64-encoded image data goes here ...\n",
- "offset_header": 1239,
- "offset_body": 1299,
- "offset_end": 1343
- }
- },
- {
- "Text": {
- "headers_rfc": {
- "content_type": {
- "ContentType": {
- "c_type": "text",
- "c_subtype": "enriched",
- "attributes": null
- }
- }
- },
- "headers_raw": [
- [
- {
- "Rfc": "content_type"
- },
- {
- "start": 1400,
- "end": 1415
- }
- ]
- ],
- "is_encoding_problem": false,
- "body": "This is
This is the HTML Section!
\nThis is the HTML Section!
\n