From 6b23f08ee0af07366de78779e8c329526442f0ca Mon Sep 17 00:00:00 2001 From: Mauro D Date: Fri, 15 Jul 2022 08:12:57 +0000 Subject: [PATCH] MimePart refactoring. --- README.md | 5 +- src/lib.rs | 35 +- src/parsers/message.rs | 78 +-- tests/legacy/000.txt | 415 ++++++-------- tests/legacy/001.txt | 374 ++++++------ tests/legacy/002.txt | 334 +++++------ tests/legacy/003.txt | 457 ++++++++------- tests/legacy/004.txt | 301 +++++----- tests/legacy/005.txt | 370 ++++++------ tests/legacy/006.txt | 563 +++++++++--------- tests/legacy/007.txt | 370 ++++++------ tests/legacy/008.txt | 753 ++++++++++++------------ tests/legacy/009.txt | 354 ++++++------ tests/legacy/010.txt | 334 +++++------ tests/legacy/011.txt | 316 +++++----- tests/legacy/012.txt | 370 ++++++------ tests/legacy/013.txt | 370 ++++++------ tests/legacy/014.txt | 493 ++++++++-------- tests/legacy/015.txt | 1081 +++++++++++++++++------------------ tests/legacy/016.txt | 537 +++++++++-------- tests/legacy/017.txt | 561 +++++++++--------- tests/legacy/018.txt | 792 +++++++++++++------------- tests/legacy/019.txt | 778 +++++++++++++------------ tests/legacy/020.txt | 370 ++++++------ tests/legacy/021.txt | 949 +++++++++++++++--------------- tests/legacy/022.txt | 370 ++++++------ tests/legacy/023.txt | 669 +++++++++++----------- tests/legacy/024.txt | 653 +++++++++++---------- tests/legacy/025.txt | 938 +++++++++++++++--------------- tests/legacy/026.txt | 569 +++++++++--------- tests/legacy/027.txt | 370 ++++++------ tests/legacy/028.txt | 766 ++++++++++++------------- tests/legacy/029.txt | 334 +++++------ tests/legacy/030.txt | 711 ++++++++++++----------- tests/legacy/031.txt | 621 ++++++++++---------- tests/legacy/032.txt | 730 ++++++++++++------------ tests/legacy/033.txt | 334 +++++------ tests/legacy/034.txt | 316 +++++----- tests/legacy/035.txt | 1063 +++++++++++++++++----------------- tests/legacy/036.txt | 280 ++++----- tests/legacy/037.txt | 471 ++++++++------- tests/legacy/038.txt | 316 +++++----- tests/legacy/039.txt | 930 +++++++++++++++--------------- tests/legacy/040.txt | 316 +++++----- tests/legacy/041.txt | 457 ++++++++------- tests/legacy/042.txt | 469 ++++++++------- tests/legacy/043.txt | 439 +++++++------- tests/legacy/044.txt | 703 ++++++++++++----------- tests/legacy/045.txt | 463 ++++++++------- tests/legacy/046.txt | 316 +++++----- tests/legacy/047.txt | 471 ++++++++------- tests/legacy/048.txt | 701 +++++++++++------------ tests/legacy/049.txt | 278 +++++---- tests/legacy/050.txt | 653 +++++++++++---------- tests/legacy/051.txt | 940 +++++++++++++++--------------- tests/legacy/052.txt | 278 +++++---- tests/legacy/053.txt | 370 ++++++------ tests/malformed/000.txt | 62 +- tests/malformed/001.txt | 170 +++--- tests/malformed/002.txt | 74 +-- tests/malformed/003.txt | 176 +++--- tests/malformed/004.txt | 95 +-- tests/malformed/005.txt | 178 +++--- tests/malformed/006.txt | 176 +++--- tests/malformed/007.txt | 180 +++--- tests/malformed/008.txt | 176 +++--- tests/malformed/009.txt | 250 ++++---- tests/malformed/010.txt | 192 ++----- tests/malformed/011.txt | 250 ++++---- tests/malformed/012.txt | 364 +++++------- tests/malformed/013.txt | 614 ++++++++++---------- tests/malformed/014.txt | 117 ++-- tests/malformed/015.txt | 407 +++++++------ tests/malformed/016.txt | 319 +++++------ tests/rfc/000.txt | 811 ++++++++++++-------------- tests/rfc/001.txt | 437 +++++++------- tests/rfc/002.txt | 709 +++++++++-------------- tests/rfc/003.txt | 389 +++++++------ tests/rfc/004.txt | 650 +++++++++------------ tests/rfc/005.txt | 315 +++++----- tests/rfc/006.txt | 373 ++++++------ tests/rfc/007.txt | 1172 ++++++++++++++++++-------------------- tests/rfc/008.txt | 580 ++++++++----------- tests/thirdparty/000.txt | 251 ++++---- tests/thirdparty/001.txt | 303 +++++----- tests/thirdparty/002.txt | 315 +++++----- tests/thirdparty/003.txt | 495 ++++++++-------- tests/thirdparty/004.txt | 569 +++++++++--------- tests/thirdparty/005.txt | Bin 6259 -> 5981 bytes tests/thirdparty/006.txt | 471 ++++++++------- tests/thirdparty/007.txt | 589 ++++++++----------- tests/thirdparty/008.txt | 754 +++++++++++------------- tests/thirdparty/009.txt | 257 +++++---- tests/thirdparty/010.txt | 213 +++---- 94 files changed, 20186 insertions(+), 21922 deletions(-) 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."
---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 31, - "second": 0, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" - }, - "mime_version": { - "Text": "1.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": 290 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 295, - "end": 332 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 340, - "end": 387 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 400, - "end": 406 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 419, - "end": 453 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 479, - "end": 498 - } - ] - ], "html_body": [ 0 ], @@ -182,53 +45,162 @@ wir."
"attachments": [], "parts": [ { - "Html": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "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": 419, - "end": 453 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 31, + "second": 0, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 479, - "end": 498 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "is_encoding_problem": false, - "body": "\nDie Hasen und die\nFrösche
\n
\n
Die 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\n", - "offset_header": 0, - "offset_body": 500, - "offset_end": 1499 - } + [ + { + "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": 290 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 295, + "end": 332 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 340, + "end": 387 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 400, + "end": 406 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 419, + "end": 453 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 479, + "end": 498 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\nDie Hasen und die\nFrösche
\n
\n
Die 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\n" + }, + "offset_header": 0, + "offset_body": 500, + "offset_end": 1499 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 500, - "offset_end": 1499 + ] } \ No newline at end of file diff --git a/tests/legacy/003.txt b/tests/legacy/003.txt index 07527da..4945798 100644 --- a/tests/legacy/003.txt +++ b/tests/legacy/003.txt @@ -63,249 +63,248 @@ wir."
---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_714967308==_.ALT" - } - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 29, - "second": 55, - "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": 290 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 295, - "end": 332 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 340, - "end": 387 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 400, - "end": 406 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 419, - "end": 496 - } - ] - ], "html_body": [ - 1 + 2 ], "text_body": [ - 0 + 1 ], "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": "dwsauder@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 553, - "end": 588 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 29, + "second": 55, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "=====================_714967308==_.ALT" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 614, - "end": 633 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 540, - "offset_body": 635, - "offset_end": 1444 - } + [ + { + "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": 290 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 295, + "end": 332 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 340, + "end": 387 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 400, + "end": 406 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 419, + "end": 496 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 498, + "offset_end": 2625 }, { - "Html": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "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": 1501, - "end": 1535 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1561, - "end": 1580 - } - ] - ], - "is_encoding_problem": false, - "body": "\nDie Hasen und die\nFrösche
\n
\n
Die 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": 1488, - "offset_body": 1582, - "offset_end": 2579 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 498, - "offset_end": 2623 + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 553, + "end": 588 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 614, + "end": 633 + } + ] + ], + "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": 540, + "offset_body": 635, + "offset_end": 1446 + }, + { + "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" + }, + { + "start": 1501, + "end": 1535 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1561, + "end": 1580 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\nDie Hasen und die\nFrösche
\n
\n
Die 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": 1488, + "offset_body": 1582, + "offset_end": 2581 + } + ] } \ No newline at end of file diff --git a/tests/legacy/004.txt b/tests/legacy/004.txt index 6766b08..6e7f500 100644 --- a/tests/legacy/004.txt +++ b/tests/legacy/004.txt @@ -18,134 +18,6 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" - }, - "subject": { - "Text": "The Hare and the Tortoise" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 13, - "second": 19, - "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": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 181, - "end": 194 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 199, - "end": 233 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 236, - "end": 266 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 271, - "end": 308 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 316, - "end": 344 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 357, - "end": 363 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 376, - "end": 409 - } - ] - ], "html_body": [ 0 ], @@ -155,41 +27,150 @@ Slow but steady wins the race. "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } + "headers_rfc": { + "subject": { + "Text": "The Hare and the Tortoise" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 376, - "end": 409 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 13, + "second": 19, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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\r\n", - "offset_header": 0, - "offset_body": 411, - "offset_end": 1177 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 181, + "end": 194 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 199, + "end": 233 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 236, + "end": 266 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 271, + "end": 308 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 316, + "end": 344 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 357, + "end": 363 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 376, + "end": 409 + } + ] + ], + "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\r\n" + }, + "offset_header": 0, + "offset_body": 411, + "offset_end": 1177 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 411, - "offset_end": 1177 + ] } \ No newline at end of file diff --git a/tests/legacy/005.txt b/tests/legacy/005.txt index d837760..2f14c86 100644 --- a/tests/legacy/005.txt +++ b/tests/legacy/005.txt @@ -32,161 +32,6 @@ ihr seht, einige Tiere, welche also wohl noch ungl+APw-cklicher sein = m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 20, - "second": 24, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 96 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 104, - "end": 175 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 180, - "end": 214 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 225, - "end": 275 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 288, - "end": 294 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 307, - "end": 339 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 365, - "end": 384 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 395, - "end": 408 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 426, - "end": 435 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 444, - "end": 497 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 508, - "end": 517 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 527, - "end": 575 - } - ] - ], "html_body": [ 0 ], @@ -196,53 +41,180 @@ m+APw-ssen als wir.+ACI-=20 "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } + "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": 307, - "end": 339 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 20, + "second": 24, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.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" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 365, - "end": 384 - } - ] + } + } + }, + "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": 577, - "offset_end": 1470 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 96 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 104, + "end": 175 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 180, + "end": 214 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 225, + "end": 275 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 288, + "end": 294 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 307, + "end": 339 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 365, + "end": 384 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 395, + "end": 408 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 426, + "end": 435 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 444, + "end": 497 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 508, + "end": 517 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 527, + "end": 575 + } + ] + ], + "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": 577, + "offset_end": 1470 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 577, - "offset_end": 1470 + ] } \ No newline at end of file diff --git a/tests/legacy/006.txt b/tests/legacy/006.txt index 6e798c2..91c8209 100644 --- a/tests/legacy/006.txt +++ b/tests/legacy/006.txt @@ -83,224 +83,236 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ------=_NextPart_000_0004_01BFC037.28F2FA90-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 36, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.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": 331 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 342, - "end": 355 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 373, - "end": 382 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 391, - "end": 444 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 455, - "end": 464 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 474, - "end": 522 - } - ] - ], "html_body": [], "text_body": [], "attachments": [ - 0, - 1 + 1, + 2 ], "parts": [ { - "Binary": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" + "headers_rfc": { + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 630, - "end": 665 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 36, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 691, - "end": 700 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 720, - "end": 760 - } - ] + } + } + }, + "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": 331 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 342, + "end": 355 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 373, + "end": 382 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 391, + "end": 444 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 455, + "end": 464 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 474, + "end": 522 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 524, + "offset_end": 4809 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 630, + "end": 665 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 691, + "end": 700 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 720, + "end": 760 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1626,68 +1638,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 617, - "offset_body": 762, - "offset_end": 2578 - } + ] + }, + "offset_header": 617, + "offset_body": 762, + "offset_end": 2580 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } - } - }, - "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" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 2638, - "end": 2672 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 2698, - "end": 2707 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 2727, - "end": 2766 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2638, + "end": 2672 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 2698, + "end": 2707 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 2727, + "end": 2766 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3141,24 +3153,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 2625, - "offset_body": 2768, - "offset_end": 4760 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + ] }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 524, - "offset_end": 4807 + "offset_header": 2625, + "offset_body": 2768, + "offset_end": 4762 + } + ] } \ No newline at end of file diff --git a/tests/legacy/007.txt b/tests/legacy/007.txt index fb35d32..7055b79 100644 --- a/tests/legacy/007.txt +++ b/tests/legacy/007.txt @@ -31,161 +31,6 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 15, - "second": 35, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 112 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 120, - "end": 194 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 199, - "end": 233 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 244, - "end": 294 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 307, - "end": 313 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 326, - "end": 363 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 389, - "end": 408 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 419, - "end": 432 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 450, - "end": 459 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 468, - "end": 521 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 532, - "end": 541 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 551, - "end": 599 - } - ] - ], "html_body": [ 0 ], @@ -195,53 +40,180 @@ Tiere, welche 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 (Microsoft Outlook 00)" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 326, - "end": 363 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 15, + "second": 35, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.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": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 389, - "end": 408 - } - ] + } + } + }, + "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\n", - "offset_header": 0, - "offset_body": 601, - "offset_end": 1410 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 112 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 120, + "end": 194 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 199, + "end": 233 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 244, + "end": 294 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 307, + "end": 313 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 408 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 419, + "end": 432 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 450, + "end": 459 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 468, + "end": 521 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 532, + "end": 541 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 551, + "end": 599 + } + ] + ], + "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": 601, + "offset_end": 1410 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 601, - "offset_end": 1410 + ] } \ No newline at end of file diff --git a/tests/legacy/008.txt b/tests/legacy/008.txt index f4046c1..abf62a9 100644 --- a/tests/legacy/008.txt +++ b/tests/legacy/008.txt @@ -135,272 +135,286 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ------=_NextPart_000_0002_01BFC036.AE309650-- ---- 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": 32, - "second": 47, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 99 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 107, - "end": 148 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 153, - "end": 187 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 198, - "end": 248 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 261, - "end": 267 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 280, - "end": 354 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 365, - "end": 378 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 396, - "end": 405 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 414, - "end": 467 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 478, - "end": 487 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 497, - "end": 545 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "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 Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 653, - "end": 690 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 32, + "second": 47, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 716, - "end": 735 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "is_encoding_problem": false, - "body": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n", - "offset_header": 640, - "offset_body": 737, - "offset_end": 1536 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 99 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 107, + "end": 148 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 153, + "end": 187 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 198, + "end": 248 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 261, + "end": 267 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 280, + "end": 354 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 365, + "end": 378 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 396, + "end": 405 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 414, + "end": 467 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 478, + "end": 487 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 497, + "end": 545 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3, + 4 + ] + }, + "offset_header": 0, + "offset_body": 547, + "offset_end": 7747 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.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_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + { + "start": 653, + "end": 690 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 716, + "end": 735 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n" + }, + "offset_header": 640, + "offset_body": 737, + "offset_end": 1538 + }, + { + "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": 1596, - "end": 1631 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1657, - "end": 1666 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1686, - "end": 1726 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1596, + "end": 1631 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1657, + "end": 1666 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1686, + "end": 1726 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1726,68 +1740,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 1583, - "offset_body": 1728, - "offset_end": 3544 - } + ] + }, + "offset_header": 1583, + "offset_body": 1728, + "offset_end": 3546 }, { - "Binary": { - "headers_rfc": { - "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" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3604, - "end": 3640 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3666, - "end": 3675 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3695, - "end": 3736 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3604, + "end": 3640 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3666, + "end": 3675 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3695, + "end": 3736 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3086,68 +3100,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 3591, - "offset_body": 3738, - "offset_end": 5516 - } + ] + }, + "offset_header": 3591, + "offset_body": 3738, + "offset_end": 5518 }, { - "Binary": { - "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": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5576, - "end": 5610 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5636, - "end": 5645 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5665, - "end": 5704 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5576, + "end": 5610 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5636, + "end": 5645 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5665, + "end": 5704 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -4601,30 +4615,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 5563, - "offset_body": 5706, - "offset_end": 7698 - } + ] + }, + "offset_header": 5563, + "offset_body": 5706, + "offset_end": 7700 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - } - ] - }, - "offset_header": 0, - "offset_body": 547, - "offset_end": 7745 + ] } \ No newline at end of file diff --git a/tests/legacy/009.txt b/tests/legacy/009.txt index 7ed7106..b5532a2 100644 --- a/tests/legacy/009.txt +++ b/tests/legacy/009.txt @@ -36,152 +36,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 6, - "second": 18, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "message_id" - }, - { - "start": 11, - "end": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "Disposition-Notification-To" - }, - { - "start": 141, - "end": 166 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 175, - "end": 223 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 234, - "end": 248 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 253, - "end": 287 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 290, - "end": 373 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 378, - "end": 415 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 423, - "end": 468 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 481, - "end": 487 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 500, - "end": 550 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 576, - "end": 595 - } - ] - ], "html_body": [ 0 ], @@ -191,54 +45,172 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "format": "flowed", - "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": 500, - "end": 550 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 6, + "second": 18, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519010441.00a8d140@pop.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", + "format": "flowed" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 576, - "end": 595 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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 erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\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": 597, - "offset_end": 1422 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "Disposition-Notification-To" + }, + { + "start": 141, + "end": 166 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 175, + "end": 223 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 234, + "end": 248 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 253, + "end": 287 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 290, + "end": 373 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 378, + "end": 415 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 423, + "end": 468 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 481, + "end": 487 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 500, + "end": 550 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 576, + "end": 595 + } + ] + ], + "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 erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\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": 597, + "offset_end": 1422 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 597, - "offset_end": 1422 + ] } \ No newline at end of file diff --git a/tests/legacy/010.txt b/tests/legacy/010.txt index 8d92528..1491f7c 100644 --- a/tests/legacy/010.txt +++ b/tests/legacy/010.txt @@ -21,143 +21,6 @@ In einem nahen Teich wollten sie sich nun ers ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Fr�sche" - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 10, - "second": 27, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz M�ller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" - } - }, - "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": 195 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 200, - "end": 234 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 237, - "end": 274 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 279, - "end": 316 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 324, - "end": 352 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 365, - "end": 371 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 384, - "end": 419 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 445, - "end": 452 - } - ] - ], "html_body": [ 0 ], @@ -167,53 +30,162 @@ In einem nahen Teich wollten sie sich nun ers "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "8bit" - }, - "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": 384, - "end": 419 + "to": { + "Address": { + "name": "Heinz M�ller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 10, + "second": 27, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 445, - "end": 452 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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 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\n\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\n\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\n\r\n\r\n", - "offset_header": 0, - "offset_body": 454, - "offset_end": 1203 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 181, + "end": 195 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 200, + "end": 234 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 237, + "end": 274 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 279, + "end": 316 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 324, + "end": 352 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 365, + "end": 371 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 384, + "end": 419 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 445, + "end": 452 + } + ] + ], + "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 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\n\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\n\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\n\r\n\r\n" + }, + "offset_header": 0, + "offset_body": 454, + "offset_end": 1203 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 454, - "offset_end": 1203 + ] } \ No newline at end of file diff --git a/tests/legacy/011.txt b/tests/legacy/011.txt index 64b0dd3..ff47c90 100644 --- a/tests/legacy/011.txt +++ b/tests/legacy/011.txt @@ -29,134 +29,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 17, - "second": 39, - "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": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 175, - "end": 209 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 212, - "end": 299 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 304, - "end": 341 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 349, - "end": 396 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 409, - "end": 415 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 428, - "end": 463 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 489, - "end": 508 - } - ] - ], "html_body": [ 0 ], @@ -166,53 +38,153 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "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": 428, - "end": 463 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 17, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519001217.00a85b60@pop.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": 489, - "end": 508 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 510, - "offset_end": 1321 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 175, + "end": 209 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 212, + "end": 299 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 304, + "end": 341 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 349, + "end": 396 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 409, + "end": 415 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 428, + "end": 463 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 489, + "end": 508 + } + ] + ], + "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": 510, + "offset_end": 1321 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 510, - "offset_end": 1321 + ] } \ No newline at end of file diff --git a/tests/legacy/012.txt b/tests/legacy/012.txt index 2434354..7ede0f2 100644 --- a/tests/legacy/012.txt +++ b/tests/legacy/012.txt @@ -30,161 +30,6 @@ ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige = Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 30, - "second": 20, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 101 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 109, - "end": 185 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 190, - "end": 224 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 235, - "end": 285 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 298, - "end": 304 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 317, - "end": 356 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 382, - "end": 401 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 412, - "end": 425 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 443, - "end": 452 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 461, - "end": 514 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 525, - "end": 534 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 544, - "end": 592 - } - ] - ], "html_body": [ 0 ], @@ -194,53 +39,180 @@ Tiere, welche 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": "Windows-1252" - } - } - }, - "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": 317, - "end": 356 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 30, + "second": 20, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.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": "Windows-1252" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 382, - "end": 401 - } - ] + } + } + }, + "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": 594, - "offset_end": 1401 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 101 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 109, + "end": 185 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 190, + "end": 224 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 235, + "end": 285 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 298, + "end": 304 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 317, + "end": 356 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 382, + "end": 401 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 412, + "end": 425 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 443, + "end": 452 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 461, + "end": 514 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 525, + "end": 534 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 544, + "end": 592 + } + ] + ], + "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": 594, + "offset_end": 1401 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 594, - "offset_end": 1401 + ] } \ No newline at end of file diff --git a/tests/legacy/013.txt b/tests/legacy/013.txt index 8981663..d388972 100644 --- a/tests/legacy/013.txt +++ b/tests/legacy/013.txt @@ -31,161 +31,6 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 13, - "second": 51, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 112 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 120, - "end": 194 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 199, - "end": 233 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 244, - "end": 294 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 307, - "end": 313 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 326, - "end": 363 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 389, - "end": 396 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 407, - "end": 420 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 438, - "end": 447 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 456, - "end": 509 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 520, - "end": 529 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 539, - "end": 587 - } - ] - ], "html_body": [ 0 ], @@ -195,53 +40,180 @@ welche also wohl noch ungl "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "8bit" + "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": 326, - "end": 363 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 13, + "second": 51, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 389, - "end": 396 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "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": 589, - "offset_end": 1341 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 112 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 120, + "end": 194 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 199, + "end": 233 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 244, + "end": 294 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 307, + "end": 313 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 396 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 407, + "end": 420 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 438, + "end": 447 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 456, + "end": 509 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 520, + "end": 529 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 539, + "end": 587 + } + ] + ], + "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": 589, + "offset_end": 1341 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 589, - "offset_end": 1341 + ] } \ No newline at end of file diff --git a/tests/legacy/014.txt b/tests/legacy/014.txt index 20e7f75..d8165d6 100644 --- a/tests/legacy/014.txt +++ b/tests/legacy/014.txt @@ -72,267 +72,266 @@ race. =20 ------=_NextPart_000_0005_01BFC037.799BEF60-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 38, - "second": 28, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.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 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 238, - "end": 244 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 257, - "end": 337 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 348, - "end": 361 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 379, - "end": 388 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 397, - "end": 450 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 461, - "end": 470 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 480, - "end": 528 - } - ] - ], "html_body": [ - 1 + 2 ], "text_body": [ - 0 + 1 ], "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": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 636, - "end": 673 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 38, + "second": 28, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 699, - "end": 718 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "is_encoding_problem": false, - "body": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n", - "offset_header": 623, - "offset_body": 720, - "offset_end": 1521 - } + [ + { + "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": 337 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 348, + "end": 361 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 379, + "end": 388 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 397, + "end": 450 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 461, + "end": 470 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 480, + "end": 528 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 530, + "offset_end": 2903 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1581, - "end": 1617 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1643, - "end": 1662 - } - ] - ], - "is_encoding_problem": false, - "body": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n", - "offset_header": 1568, - "offset_body": 1664, - "offset_end": 2854 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + } + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 530, - "offset_end": 2901 + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 636, + "end": 673 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 699, + "end": 718 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n" + }, + "offset_header": 623, + "offset_body": 720, + "offset_end": 1523 + }, + { + "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" + }, + { + "start": 1581, + "end": 1617 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1643, + "end": 1662 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n" + }, + "offset_header": 1568, + "offset_body": 1664, + "offset_end": 2856 + } + ] } \ No newline at end of file diff --git a/tests/legacy/015.txt b/tests/legacy/015.txt index 8dad01c..faaed60 100644 --- a/tests/legacy/015.txt +++ b/tests/legacy/015.txt @@ -198,369 +198,393 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 36, - "second": 58, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715392540==_" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - } - }, - "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": [ - 3 + 4 ], "text_body": [ - 2 + 3 ], "attachments": [ - 4, 5, 6, - 7 + 7, + 8 ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "multipart/alternative", - "boundary": "=====================_715392540==_.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": 640 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 36, + "second": 58, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715392540==_" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "offset_header": 522, - "offset_body": 642, - "offset_end": 7504 - } + [ + { + "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, + 7, + 8 + ] + }, + "offset_header": 0, + "offset_body": 484, + "offset_end": 11500 }, { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_715392550==_.ALT" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "multipart/alternative", + "boundary": "=====================_715392540==_.REL" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 697, - "end": 774 - } - ] - ], - "offset_header": 684, - "offset_body": 776, - "offset_end": 3160 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 535, + "end": 640 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 5, + 6 + ] + }, + "offset_header": 522, + "offset_body": 642, + "offset_end": 7504 }, { - "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": "=====================_715392550==_.ALT" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 831, - "end": 866 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 892, - "end": 911 - } - ] - ], - "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\n2aa3ed95.png2aa3edd1.png", - "offset_header": 818, - "offset_body": 913, - "offset_end": 1746 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 697, + "end": 774 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 4 + ] + }, + "offset_header": 684, + "offset_body": 776, + "offset_end": 3160 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1803, - "end": 1837 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1863, - "end": 1882 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 831, + "end": 866 + } ], - "is_encoding_problem": false, - "body": "\nDie Hasen und die\nFrösche
\n
\n
Die 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
\"2aa3ed95.png\"\"2aa3edd1.png\"\n", - "offset_header": 1790, - "offset_body": 1884, - "offset_end": 3114 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 892, + "end": 911 + } + ] + ], + "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\n2aa3ed95.png2aa3edd1.png" + }, + "offset_header": 818, + "offset_body": 913, + "offset_end": 1748 }, { - "Binary": { - "headers_rfc": { - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa3ed95.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": "2aa3ed95.png" - } + { + "start": 1803, + "end": 1837 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1863, + "end": 1882 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\nDie Hasen und die\nFrösche
\n
\n
Die 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
\"2aa3ed95.png\"\"2aa3edd1.png\"\n" + }, + "offset_header": 1790, + "offset_body": 1884, + "offset_end": 3116 + }, + { + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa3ed95.png" } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3217, - "end": 3250 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa3ed95.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 3261, - "end": 3316 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3342, - "end": 3351 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3371, - "end": 3405 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3217, + "end": 3250 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 3261, + "end": 3316 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3342, + "end": 3351 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3371, + "end": 3405 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1886,80 +1910,80 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 3204, - "offset_body": 3407, - "offset_end": 5221 - } + ] + }, + "offset_header": 3204, + "offset_body": 3407, + "offset_end": 5223 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa3edd1.png" - } + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa3edd1.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa3edd1.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5278, - "end": 5311 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa3edd1.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 5322, - "end": 5377 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5403, - "end": 5412 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5432, - "end": 5466 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5278, + "end": 5311 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 5322, + "end": 5377 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5403, + "end": 5412 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5432, + "end": 5466 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3413,68 +3437,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 5265, - "offset_body": 5468, - "offset_end": 7458 - } + ] + }, + "offset_header": 5265, + "offset_body": 5468, + "offset_end": 7460 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "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": 7557, - "end": 7590 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 7616, - "end": 7625 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 7645, - "end": 7683 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7557, + "end": 7590 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 7616, + "end": 7625 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 7645, + "end": 7683 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -4800,68 +4824,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 7544, - "offset_body": 7685, - "offset_end": 9499 - } + ] + }, + "offset_header": 7544, + "offset_body": 7685, + "offset_end": 9501 }, { - "Binary": { - "headers_rfc": { - "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" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 9552, - "end": 9586 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 9612, - "end": 9621 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 9641, - "end": 9680 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 9552, + "end": 9586 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 9612, + "end": 9621 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 9641, + "end": 9680 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -6160,50 +6184,11 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 9539, - "offset_body": 9682, - "offset_end": 11458 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "MultiPart": [ - 1, - [ - { - "Part": 2 - }, - { - "Part": 3 - } - ] - ] - }, - { - "Part": 4 - }, - { - "Part": 5 - } - ] ] }, - { - "Part": 6 - }, - { - "Part": 7 - } - ] - }, - "offset_header": 0, - "offset_body": 484, - "offset_end": 11498 + "offset_header": 9539, + "offset_body": 9682, + "offset_end": 11460 + } + ] } \ No newline at end of file diff --git a/tests/legacy/016.txt b/tests/legacy/016.txt index d6b7a6e..2f5ac94 100644 --- a/tests/legacy/016.txt +++ b/tests/legacy/016.txt @@ -95,232 +95,245 @@ JB@ac)(GTFLiL)!d09'8!!!: ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 53, - "second": 25, - "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": "=====================_716373961==_" - } - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "message_id" - }, - { - "start": 11, - "end": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 175, - "end": 209 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 212, - "end": 295 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 300, - "end": 337 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 345, - "end": 390 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 403, - "end": 409 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 422, - "end": 489 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "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": 542, - "end": 577 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 53, + "second": 25, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716373961==_" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 603, - "end": 622 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 529, - "offset_body": 624, - "offset_end": 1433 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 175, + "end": 209 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 212, + "end": 295 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 300, + "end": 337 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 345, + "end": 390 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 403, + "end": 409 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 422, + "end": 489 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 491, + "offset_end": 4871 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "mac-binhex40", - "attributes": { - "name": "blueball.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": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } + { + "start": 542, + "end": 577 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 603, + "end": 622 + } + ] + ], + "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": 529, + "offset_body": 624, + "offset_end": 1435 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "mac-binhex40", + "attributes": { + "name": "blueball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1486, - "end": 1534 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1554, - "end": 1592 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1486, + "end": 1534 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1554, + "end": 1592 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 13, 10, 40, @@ -2250,56 +2263,56 @@ JB@ac)(GTFLiL)!d09'8!!!: 58, 13, 10 - ], - "offset_header": 1473, - "offset_body": 1594, - "offset_end": 3523 - } + ] + }, + "offset_header": 1473, + "offset_body": 1594, + "offset_end": 3525 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "mac-binhex40", - "attributes": { - "name": "HasenundFr�sche.txt" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "HasenundFr�sche.txt" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "mac-binhex40", + "attributes": { + "name": "HasenundFr�sche.txt" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3576, - "end": 3631 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "HasenundFr�sche.txt" } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3651, - "end": 3696 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3576, + "end": 3631 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3651, + "end": 3696 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 13, 10, 40, @@ -3431,27 +3444,11 @@ JB@ac)(GTFLiL)!d09'8!!!: 58, 13, 10 - ], - "offset_header": 3563, - "offset_body": 3698, - "offset_end": 4829 - } + ] + }, + "offset_header": 3563, + "offset_body": 3698, + "offset_end": 4831 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 491, - "offset_end": 4869 + ] } \ No newline at end of file diff --git a/tests/legacy/017.txt b/tests/legacy/017.txt index 2e0aa8a..9e603f6 100644 --- a/tests/legacy/017.txt +++ b/tests/legacy/017.txt @@ -102,232 +102,245 @@ end ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" - }, - "subject": { - "Text": "The Hare and the Tortoise" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "jschmuergen@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 50, - "second": 8, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716177458==_" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "message_id" - }, - { - "start": 11, - "end": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 175, - "end": 209 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 212, - "end": 257 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 262, - "end": 299 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 307, - "end": 335 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 348, - "end": 354 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 367, - "end": 434 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } + "headers_rfc": { + "subject": { + "Text": "The Hare and the Tortoise" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 487, - "end": 520 + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "jschmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 50, + "second": 8, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716177458==_" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 474, - "offset_body": 522, - "offset_end": 1286 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 175, + "end": 209 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 212, + "end": 257 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 262, + "end": 299 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 307, + "end": 335 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 348, + "end": 354 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 367, + "end": 434 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 436, + "offset_end": 5446 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + { + "start": 487, + "end": 520 + } + ] + ], + "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": 474, + "offset_body": 522, + "offset_end": 1288 + }, + { + "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": 1339, - "end": 1373 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1399, - "end": 1412 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1432, - "end": 1471 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1339, + "end": 1373 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1399, + "end": 1412 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1432, + "end": 1471 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 13, 10, 98, @@ -2182,68 +2195,68 @@ end 100, 13, 10 - ], - "offset_header": 1326, - "offset_body": 1473, - "offset_end": 3327 - } + ] + }, + "offset_header": 1326, + "offset_body": 1473, + "offset_end": 3329 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "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" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3380, - "end": 3413 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3439, - "end": 3452 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3472, - "end": 3510 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3380, + "end": 3413 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3439, + "end": 3452 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3472, + "end": 3510 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 13, 10, 98, @@ -4136,27 +4149,11 @@ end 100, 13, 10 - ], - "offset_header": 3367, - "offset_body": 3512, - "offset_end": 5404 - } + ] + }, + "offset_header": 3367, + "offset_body": 3512, + "offset_end": 5406 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 436, - "offset_end": 5444 + ] } \ No newline at end of file diff --git a/tests/legacy/018.txt b/tests/legacy/018.txt index 78973d1..a0d65bb 100644 --- a/tests/legacy/018.txt +++ b/tests/legacy/018.txt @@ -138,338 +138,356 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "multipart/alternative", - "boundary": "=====================_715157131==_.REL" - } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 33, - "second": 1, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.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": 520 - } - ] - ], "html_body": [ - 2 + 3 ], "text_body": [ - 1 + 2 ], "attachments": [ - 3, - 4 + 4, + 5 ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_715157141==_.ALT" - } - } + "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": 577, - "end": 654 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 33, + "second": 1, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "multipart/alternative", + "boundary": "=====================_715157131==_.REL" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "offset_header": 564, - "offset_body": 656, - "offset_end": 3051 - } + [ + { + "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": 520 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 4, + 5 + ] + }, + "offset_header": 0, + "offset_body": 522, + "offset_end": 7393 }, { - "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": "=====================_715157141==_.ALT" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 711, - "end": 746 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 772, - "end": 791 - } - ] - ], - "is_encoding_problem": false, - "body": "blueball.png\n\nDie 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\nredball.png", - "offset_header": 698, - "offset_body": 793, - "offset_end": 1629 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 577, + "end": 654 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 3 + ] + }, + "offset_header": 564, + "offset_body": 656, + "offset_end": 3051 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1686, - "end": 1720 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1746, - "end": 1765 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 711, + "end": 746 + } ], - "is_encoding_problem": false, - "body": "\n\"blueball.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"redball.png\"
\n", - "offset_header": 1673, - "offset_body": 1767, - "offset_end": 3005 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 772, + "end": 791 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "blueball.png\n\nDie 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\nredball.png" + }, + "offset_header": 698, + "offset_body": 793, + "offset_end": 1631 }, { - "Binary": { - "headers_rfc": { - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "blueball.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": "blueball.png" - } + { + "start": 1686, + "end": 1720 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1746, + "end": 1765 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\"blueball.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"redball.png\"
\n" + }, + "offset_header": 1673, + "offset_body": 1767, + "offset_end": 3007 + }, + { + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3108, - "end": 3141 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 3152, - "end": 3207 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3233, - "end": 3242 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3262, - "end": 3296 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3108, + "end": 3141 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 3152, + "end": 3207 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3233, + "end": 3242 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3262, + "end": 3296 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1795,80 +1813,80 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 3095, - "offset_body": 3298, - "offset_end": 5112 - } + ] + }, + "offset_header": 3095, + "offset_body": 3298, + "offset_end": 5114 }, { - "Binary": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5169, - "end": 5201 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 5212, - "end": 5267 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5293, - "end": 5302 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5322, - "end": 5355 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5169, + "end": 5201 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 5212, + "end": 5267 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5293, + "end": 5302 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5322, + "end": 5355 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3322,37 +3340,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 5156, - "offset_body": 5357, - "offset_end": 7347 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "Part": 1 - }, - { - "Part": 2 - } - ] ] }, - { - "Part": 3 - }, - { - "Part": 4 - } - ] - }, - "offset_header": 0, - "offset_body": 522, - "offset_end": 7391 + "offset_header": 5156, + "offset_body": 5357, + "offset_end": 7349 + } + ] } \ No newline at end of file diff --git a/tests/legacy/019.txt b/tests/legacy/019.txt index 8d65493..95a01bc 100644 --- a/tests/legacy/019.txt +++ b/tests/legacy/019.txt @@ -144,343 +144,361 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ------=_NextPart_000_0008_01BFC037.FDD8EE90-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0008_01BFC037.FDD8EE90" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 42, - "second": 10, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.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": 331 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 342, - "end": 355 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 373, - "end": 382 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 391, - "end": 444 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 455, - "end": 464 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 474, - "end": 522 - } - ] - ], "html_body": [ - 2 + 3 ], "text_body": [ - 1 + 2 ], "attachments": [ - 3, - 4 + 4, + 5 ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_001_0009_01BFC037.FDD8EE90" - } - } + "headers_rfc": { + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 630, - "end": 710 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 42, + "second": 10, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0008_01BFC037.FDD8EE90" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "offset_header": 617, - "offset_body": 712, - "offset_end": 3039 - } + [ + { + "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": 331 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 342, + "end": 355 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 373, + "end": 382 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 391, + "end": 444 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 455, + "end": 464 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 474, + "end": 522 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 4, + 5 + ] + }, + "offset_header": 0, + "offset_body": 524, + "offset_end": 7242 }, { - "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": "----=_NextPart_001_0009_01BFC037.FDD8EE90" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 772, - "end": 809 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 835, - "end": 854 - } - ] - ], - "is_encoding_problem": false, - "body": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n", - "offset_header": 759, - "offset_body": 856, - "offset_end": 1657 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 630, + "end": 710 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 3 + ] + }, + "offset_header": 617, + "offset_body": 712, + "offset_end": 3039 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1717, - "end": 1753 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1779, - "end": 1798 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 772, + "end": 809 + } ], - "is_encoding_problem": false, - "body": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n", - "offset_header": 1704, - "offset_body": 1800, - "offset_end": 2990 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 835, + "end": 854 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n" + }, + "offset_header": 759, + "offset_body": 856, + "offset_end": 1659 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.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_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } + { + "start": 1717, + "end": 1753 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1779, + "end": 1798 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n" + }, + "offset_header": 1704, + "offset_body": 1800, + "offset_end": 2992 + }, + { + "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": 3099, - "end": 3135 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3161, - "end": 3170 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3190, - "end": 3231 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3099, + "end": 3135 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3161, + "end": 3170 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3190, + "end": 3231 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1779,68 +1797,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 3086, - "offset_body": 3233, - "offset_end": 5011 - } + ] + }, + "offset_header": 3086, + "offset_body": 3233, + "offset_end": 5013 }, { - "Binary": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5071, - "end": 5105 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5131, - "end": 5140 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5160, - "end": 5199 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5071, + "end": 5105 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5131, + "end": 5140 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5160, + "end": 5199 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3294,37 +3312,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 5058, - "offset_body": 5201, - "offset_end": 7193 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "Part": 1 - }, - { - "Part": 2 - } - ] ] }, - { - "Part": 3 - }, - { - "Part": 4 - } - ] - }, - "offset_header": 0, - "offset_body": 524, - "offset_end": 7240 + "offset_header": 5058, + "offset_body": 5201, + "offset_end": 7195 + } + ] } \ No newline at end of file diff --git a/tests/legacy/020.txt b/tests/legacy/020.txt index 462717e..a573962 100644 --- a/tests/legacy/020.txt +++ b/tests/legacy/020.txt @@ -31,161 +31,6 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 8, - "second": 29, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 89 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 97, - "end": 148 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 153, - "end": 187 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 198, - "end": 248 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 261, - "end": 267 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 280, - "end": 317 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 343, - "end": 350 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 361, - "end": 374 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 392, - "end": 401 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 410, - "end": 463 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 474, - "end": 483 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 493, - "end": 541 - } - ] - ], "html_body": [ 0 ], @@ -195,53 +40,180 @@ welche also wohl noch ungl "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "8bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } + "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": 280, - "end": 317 + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "schmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 8, + "second": 29, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 343, - "end": 350 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "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": 543, - "offset_end": 1295 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 89 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 97, + "end": 148 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 153, + "end": 187 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 198, + "end": 248 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 261, + "end": 267 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 280, + "end": 317 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 343, + "end": 350 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 361, + "end": 374 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 392, + "end": 401 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 410, + "end": 463 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 474, + "end": 483 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 493, + "end": 541 + } + ] + ], + "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": 543, + "offset_end": 1295 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 543, - "offset_end": 1295 + ] } \ No newline at end of file diff --git a/tests/legacy/021.txt b/tests/legacy/021.txt index dcb5c32..d99fba8 100644 --- a/tests/legacy/021.txt +++ b/tests/legacy/021.txt @@ -188,367 +188,390 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ------=_NextPart_000_0010_01BFC038.B91BC650-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 47, - "second": 24, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" - } - } - } - }, - "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": 331 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 342, - "end": 355 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 373, - "end": 382 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 391, - "end": 444 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 455, - "end": 464 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 474, - "end": 522 - } - ] - ], "html_body": [ - 3 + 4 ], "text_body": [ - 2 + 3 ], "attachments": [ - 4, 5, - 6 + 6, + 7 ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "----=_NextPart_001_0011_01BFC038.B91BC650" - } - } + "headers_rfc": { + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 630, - "end": 706 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 47, + "second": 24, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "offset_header": 617, - "offset_body": 708, - "offset_end": 5424 - } + [ + { + "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": 331 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 342, + "end": 355 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 373, + "end": 382 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 391, + "end": 444 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 455, + "end": 464 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 474, + "end": 522 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 6, + 7 + ] + }, + "offset_header": 0, + "offset_body": 524, + "offset_end": 9627 }, { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_002_0012_01BFC038.B91BC650" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "----=_NextPart_001_0011_01BFC038.B91BC650" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 768, - "end": 848 - } - ] - ], - "offset_header": 755, - "offset_body": 850, - "offset_end": 3388 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 630, + "end": 706 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 5 + ] + }, + "offset_header": 617, + "offset_body": 708, + "offset_end": 5424 }, { - "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": "----=_NextPart_002_0012_01BFC038.B91BC650" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 910, - "end": 947 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 973, - "end": 992 - } - ] - ], - "is_encoding_problem": false, - "body": "\n\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n\n", - "offset_header": 897, - "offset_body": 994, - "offset_end": 1799 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 768, + "end": 848 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 4 + ] + }, + "offset_header": 755, + "offset_body": 850, + "offset_end": 3388 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1859, - "end": 1895 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1921, - "end": 1940 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 910, + "end": 947 + } ], - "is_encoding_problem": false, - "body": "\n\n\n\n\n
\"blue
\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n

 
\n", - "offset_header": 1846, - "offset_body": 1942, - "offset_end": 3339 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 973, + "end": 992 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "\n\nThe Hare and the Tortoise \n \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. \n \nSlow but steady wins the race. \n\n\n" + }, + "offset_header": 897, + "offset_body": 994, + "offset_end": 1801 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_id": { - "Text": "938014623@17052000-0f9b" - }, - "content_transfer_encoding": { - "Text": "base64" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3448, - "end": 3483 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3509, - "end": 3518 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 3529, - "end": 3557 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1859, + "end": 1895 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1921, + "end": 1940 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\n\n\n\n
\"blue
\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n

 
\n" + }, + "offset_header": 1846, + "offset_body": 1942, + "offset_end": 3341 + }, + { + "headers_rfc": { + "content_id": { + "Text": "938014623@17052000-0f9b" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3448, + "end": 3483 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3509, + "end": 3518 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 3529, + "end": 3557 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1874,68 +1897,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 3435, - "offset_body": 3559, - "offset_end": 5375 - } + ] + }, + "offset_header": 3435, + "offset_body": 3559, + "offset_end": 5377 }, { - "Binary": { - "headers_rfc": { - "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" } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5484, - "end": 5520 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5546, - "end": 5555 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5575, - "end": 5616 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5484, + "end": 5520 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5546, + "end": 5555 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5575, + "end": 5616 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3234,68 +3257,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 5471, - "offset_body": 5618, - "offset_end": 7396 - } + ] + }, + "offset_header": 5471, + "offset_body": 5618, + "offset_end": 7398 }, { - "Binary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } - } - }, - "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" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 7456, - "end": 7490 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 7516, - "end": 7525 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 7545, - "end": 7584 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7456, + "end": 7490 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 7516, + "end": 7525 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 7545, + "end": 7584 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -4749,47 +4772,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 7443, - "offset_body": 7586, - "offset_end": 9578 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "MultiPart": [ - 1, - [ - { - "Part": 2 - }, - { - "Part": 3 - } - ] - ] - }, - { - "Part": 4 - } - ] ] }, - { - "Part": 5 - }, - { - "Part": 6 - } - ] - }, - "offset_header": 0, - "offset_body": 524, - "offset_end": 9625 + "offset_header": 7443, + "offset_body": 7586, + "offset_end": 9580 + } + ] } \ No newline at end of file diff --git a/tests/legacy/022.txt b/tests/legacy/022.txt index 7676fa8..76c769d 100644 --- a/tests/legacy/022.txt +++ b/tests/legacy/022.txt @@ -30,161 +30,6 @@ IiANCg== ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 11, - "second": 50, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 40 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 43, - "end": 89 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 97, - "end": 148 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 153, - "end": 187 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 198, - "end": 248 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 261, - "end": 267 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 280, - "end": 317 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 343, - "end": 352 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 363, - "end": 376 - } - ], - [ - { - "Other": "X-MSMail-Priority" - }, - { - "start": 394, - "end": 403 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 412, - "end": 465 - } - ], - [ - { - "Other": "Importance" - }, - { - "start": 476, - "end": 485 - } - ], - [ - { - "Other": "X-MimeOLE" - }, - { - "start": 495, - "end": 543 - } - ] - ], "html_body": [ 0 ], @@ -194,53 +39,180 @@ IiANCg== "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" + "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": 280, - "end": 317 + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "schmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 11, + "second": 50, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 343, - "end": 352 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 40 + } ], - "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 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\n\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\n\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\n", - "offset_header": 0, - "offset_body": 545, - "offset_end": 1571 - } + [ + { + "Rfc": "to" + }, + { + "start": 43, + "end": 89 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 97, + "end": 148 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 153, + "end": 187 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 198, + "end": 248 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 261, + "end": 267 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 280, + "end": 317 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 343, + "end": 352 + } + ], + [ + { + "Other": "X-Priority" + }, + { + "start": 363, + "end": 376 + } + ], + [ + { + "Other": "X-MSMail-Priority" + }, + { + "start": 394, + "end": 403 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 412, + "end": 465 + } + ], + [ + { + "Other": "Importance" + }, + { + "start": 476, + "end": 485 + } + ], + [ + { + "Other": "X-MimeOLE" + }, + { + "start": 495, + "end": 543 + } + ] + ], + "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 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\n\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\n\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\n" + }, + "offset_header": 0, + "offset_body": 545, + "offset_end": 1571 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 545, - "offset_end": 1571 + ] } \ No newline at end of file diff --git a/tests/legacy/023.txt b/tests/legacy/023.txt index fdea7e7..a15cc02 100644 --- a/tests/legacy/023.txt +++ b/tests/legacy/023.txt @@ -108,245 +108,259 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 56, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716541962==_" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" - } - }, - "headers_raw": [ - [ - { - "Rfc": "message_id" - }, - { - "start": 11, - "end": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 175, - "end": 209 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 212, - "end": 295 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 300, - "end": 337 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 345, - "end": 390 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 403, - "end": 409 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 422, - "end": 489 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, 2, - 3 + 3, + 4 ], "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": 542, - "end": 577 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 56, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716541962==_" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 603, - "end": 622 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 529, - "offset_body": 624, - "offset_end": 1433 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 175, + "end": 209 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 212, + "end": 295 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 300, + "end": 337 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 345, + "end": 390 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 403, + "end": 409 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 422, + "end": 489 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3, + 4 + ] + }, + "offset_header": 0, + "offset_body": 491, + "offset_end": 5435 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.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_transfer_encoding": { - "Text": "base64" + { + "start": 542, + "end": 577 + } + ], + [ + { + "Rfc": "content_transfer_encoding" }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } + { + "start": 603, + "end": 622 + } + ] + ], + "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": 529, + "offset_body": 624, + "offset_end": 1435 + }, + { + "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": 1486, - "end": 1519 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1545, - "end": 1554 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1574, - "end": 1612 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1486, + "end": 1519 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1545, + "end": 1554 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1574, + "end": 1612 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1672,140 +1686,121 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= 66, 96, 130 - ], - "offset_header": 1473, - "offset_body": 1614, - "offset_end": 3428 - } + ] + }, + "offset_header": 1473, + "offset_body": 1614, + "offset_end": 3430 }, { - "Text": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "farmerandstork.txt" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3481, - "end": 3514 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "farmerandstork.txt" } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3534, - "end": 3578 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3481, + "end": 3514 + } ], - "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": 3468, - "offset_body": 3580, - "offset_end": 4384 - } + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3534, + "end": 3578 + } + ] + ], + "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": 3468, + "offset_body": 3580, + "offset_end": 4386 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "HasenundFr�sche.txt" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "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": 4437, - "end": 4472 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "HasenundFr�sche.txt" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 4498, - "end": 4517 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 4537, - "end": 4582 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4437, + "end": 4472 + } ], - "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": 4424, - "offset_body": 4584, - "offset_end": 5393 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 4498, + "end": 4517 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 4537, + "end": 4582 + } + ] + ], + "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": 4424, + "offset_body": 4584, + "offset_end": 5395 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - } - ] - }, - "offset_header": 0, - "offset_body": 491, - "offset_end": 5433 + ] } \ No newline at end of file diff --git a/tests/legacy/024.txt b/tests/legacy/024.txt index 97ccdef..d38eddf 100644 --- a/tests/legacy/024.txt +++ b/tests/legacy/024.txt @@ -109,266 +109,279 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 37, - "second": 39, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "=====================_715429112==_.REL", - "type": "text/html" - } - } - } - }, - "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": 508 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "parts": [ { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "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": "dwsauder@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 565, - "end": 599 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 37, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "text/html", + "boundary": "=====================_715429112==_.REL" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 625, - "end": 644 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "is_encoding_problem": false, - "body": "\n\"2aa48eb6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"2aa48ec0.png\"
\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_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48eb6.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_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa48eb6.png" - } + { + "start": 565, + "end": 599 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 625, + "end": 644 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\"2aa48eb6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"2aa48ec0.png\"
\n" + }, + "offset_header": 552, + "offset_body": 646, + "offset_end": 1887 + }, + { + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48eb6.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1942, - "end": 1975 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa48eb6.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": "2aa48ec0.png" - } + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48ec0.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48ec0.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 4003, - "end": 4036 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa48ec0.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/025.txt b/tests/legacy/025.txt index 47f70f2..3a6053f 100644 --- a/tests/legacy/025.txt +++ b/tests/legacy/025.txt @@ -171,297 +171,316 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715462801==_" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 38, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - } - }, - "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/html", - "boundary": "=====================_715462801==_.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": 628 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 38, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715462801==_" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "offset_header": 522, - "offset_body": 630, - "offset_end": 6340 - } + [ + { + "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": 10336 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "text/html", + "boundary": "=====================_715462801==_.REL" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 685, - "end": 719 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 745, - "end": 764 - } - ] - ], - "is_encoding_problem": false, - "body": "\nDie Hasen und die\nFrösche
\n
\n
Die 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
\"2aa51367.png\"\"2aa51371.png\"\n", - "offset_header": 672, - "offset_body": 766, - "offset_end": 1996 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 535, + "end": 628 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 3, + 4 + ] + }, + "offset_header": 522, + "offset_body": 630, + "offset_end": 6340 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa51367.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_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" + { + "start": 685, + "end": 719 + } + ], + [ + { + "Rfc": "content_transfer_encoding" }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa51367.png" - } + { + "start": 745, + "end": 764 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\nDie Hasen und die\nFrösche
\n
\n
Die 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
\"2aa51367.png\"\"2aa51371.png\"\n" + }, + "offset_header": 672, + "offset_body": 766, + "offset_end": 1998 + }, + { + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa51367.png" } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 2053, - "end": 2086 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa51367.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 2097, - "end": 2152 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 2178, - "end": 2187 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 2207, - "end": 2241 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2053, + "end": 2086 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 2097, + "end": 2152 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 2178, + "end": 2187 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 2207, + "end": 2241 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1787,80 +1806,80 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 2040, - "offset_body": 2243, - "offset_end": 4057 - } + ] + }, + "offset_header": 2040, + "offset_body": 2243, + "offset_end": 4059 }, { - "Binary": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa51371.png" - } + "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa51371.png" } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa51371.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 4114, - "end": 4147 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa51371.png" } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 4158, - "end": 4213 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 4239, - "end": 4248 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 4268, - "end": 4302 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4114, + "end": 4147 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_id" + }, + { + "start": 4158, + "end": 4213 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 4239, + "end": 4248 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 4268, + "end": 4302 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3314,68 +3333,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 4101, - "offset_body": 4304, - "offset_end": 6294 - } + ] + }, + "offset_header": 4101, + "offset_body": 4304, + "offset_end": 6296 }, { - "Binary": { - "headers_rfc": { - "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" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 6393, - "end": 6426 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 6452, - "end": 6461 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 6481, - "end": 6519 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 6393, + "end": 6426 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 6452, + "end": 6461 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 6481, + "end": 6519 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -4701,68 +4720,68 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 6380, - "offset_body": 6521, - "offset_end": 8335 - } + ] + }, + "offset_header": 6380, + "offset_body": 6521, + "offset_end": 8337 }, { - "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": 8388, - "end": 8422 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 8448, - "end": 8457 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 8477, - "end": 8516 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 8388, + "end": 8422 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 8448, + "end": 8457 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 8477, + "end": 8516 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -6061,40 +6080,11 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 8375, - "offset_body": 8518, - "offset_end": 10294 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - } - ] ] }, - { - "Part": 4 - }, - { - "Part": 5 - } - ] - }, - "offset_header": 0, - "offset_body": 484, - "offset_end": 10334 + "offset_header": 8375, + "offset_body": 8518, + "offset_end": 10296 + } + ] } \ No newline at end of file diff --git a/tests/legacy/026.txt b/tests/legacy/026.txt index bd1e52b..ab26b44 100644 --- a/tests/legacy/026.txt +++ b/tests/legacy/026.txt @@ -84,315 +84,312 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 59, - "second": 31, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716740438==_" - } - } - }, - "mime_version": { - "Text": "1.0" - } - }, - "headers_raw": [ - [ - { - "Rfc": "message_id" - }, - { - "start": 11, - "end": 64 - } - ], - [ - { - "Other": "X-Sender" - }, - { - "start": 73, - "end": 113 - } - ], - [ - { - "Other": "X-Mailer" - }, - { - "start": 122, - "end": 170 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 175, - "end": 209 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 212, - "end": 266 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 271, - "end": 308 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 316, - "end": 361 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 374, - "end": 380 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 393, - "end": 460 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "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": 513, - "end": 548 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 59, + "second": 31, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716740438==_" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 574, - "end": 593 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "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": 500, - "offset_body": 595, - "offset_end": 1404 - } + [ + { + "Other": "X-Sender" + }, + { + "start": 73, + "end": 113 + } + ], + [ + { + "Other": "X-Mailer" + }, + { + "start": 122, + "end": 170 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 175, + "end": 209 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 212, + "end": 266 + } + ], + [ + { + "Rfc": "from" + }, + { + "start": 271, + "end": 308 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 316, + "end": 361 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 374, + "end": 380 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 393, + "end": 460 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 462, + "offset_end": 3741 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "name": "HasenundFr�sche.txt", - "x-mac-creator": "74747874", - "x-mac-type": "54455854" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "HasenundFr�sche.txt" - } + "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": 1457, - "end": 1549 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1575, - "end": 1588 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1608, - "end": 1653 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 513, + "end": 548 + } ], - "is_encoding_problem": false, - "body": "\r\nbegin 600 HasenundFr�sche.txt\r\nM1&EE($AA\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue.  
\n
 
\n
\"blue
 
Slow but steady wins \nthe race. 
\n
 
\n
\"red
\n", - "offset_header": 1714, - "offset_body": 1810, - "offset_end": 3386 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 837, + "end": 856 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "\nThe Hare and the Tortoise \n \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. \n\n\n \nSlow but steady wins the race. \n\n\n\n" + }, + "offset_header": 761, + "offset_body": 858, + "offset_end": 1669 }, { - "Binary": { - "headers_rfc": { - "content_id": { - "Text": "823504223@17052000-0f8d" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3495, - "end": 3530 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3556, - "end": 3565 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 3576, - "end": 3604 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1727, + "end": 1763 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1789, + "end": 1808 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue.  
\n
 
\n
\"blue
 
Slow but steady wins \nthe race. 
\n
 
\n
\"red
\n" + }, + "offset_header": 1714, + "offset_body": 1810, + "offset_end": 3388 + }, + { + "headers_rfc": { + "content_id": { + "Text": "823504223@17052000-0f8d" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3495, + "end": 3530 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3556, + "end": 3565 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 3576, + "end": 3604 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1812,62 +1830,62 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 3482, - "offset_body": 3606, - "offset_end": 5422 - } + ] + }, + "offset_header": 3482, + "offset_body": 3606, + "offset_end": 5424 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "823504223@17052000-0f94" - } + "headers_rfc": { + "content_id": { + "Text": "823504223@17052000-0f94" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5482, - "end": 5516 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5542, - "end": 5551 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 5562, - "end": 5590 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5482, + "end": 5516 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5542, + "end": 5551 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 5562, + "end": 5590 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3321,37 +3339,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ], - "offset_header": 5469, - "offset_body": 5592, - "offset_end": 7584 - } - } - ], - "structure": { - "List": [ - { - "MultiPart": [ - 0, - [ - { - "Part": 1 - }, - { - "Part": 2 - } - ] ] }, - { - "Part": 3 - }, - { - "Part": 4 - } - ] - }, - "offset_header": 0, - "offset_body": 526, - "offset_end": 7631 + "offset_header": 5469, + "offset_body": 5592, + "offset_end": 7586 + } + ] } \ No newline at end of file diff --git a/tests/legacy/029.txt b/tests/legacy/029.txt index 9eb0c83..9aa140f 100644 --- a/tests/legacy/029.txt +++ b/tests/legacy/029.txt @@ -27,143 +27,6 @@ reached the goal, and was comfortably dozing after her fatigue. Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 26, - "second": 16, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "message_id": { - "Text": "392362D8.B650789F@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 - } - ], - [ - { - "Other": "X-Priority" - }, - { - "start": 305, - "end": 319 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 332, - "end": 363 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 389, - "end": 396 - } - ] - ], "html_body": [ 0 ], @@ -173,53 +36,162 @@ Slow but steady wins the race. "attachments": [], "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": 332, - "end": 363 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 26, + "second": 16, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "392362D8.B650789F@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": 389, - "end": 396 - } - ] + } + } + }, + "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.\r\n", - "offset_header": 0, - "offset_body": 398, - "offset_end": 1167 - } + [ + { + "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": 319 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 332, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 396 + } + ] + ], + "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.\r\n" + }, + "offset_header": 0, + "offset_body": 398, + "offset_end": 1167 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 398, - "offset_end": 1167 + ] } \ No newline at end of file diff --git a/tests/legacy/030.txt b/tests/legacy/030.txt index 62c6905..555be90 100644 --- a/tests/legacy/030.txt +++ b/tests/legacy/030.txt @@ -111,249 +111,263 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "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": 28, - "second": 27, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "3923635B.85C58444@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------0BBC657DDC74A0B8454627FD" - } - } - } - }, - "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 - ], - "text_body": [ - 0, - 1, - 2 - ], - "attachments": [ 1, 2, 3 ], + "text_body": [ + 1, + 2, + 3 + ], + "attachments": [ + 2, + 3, + 4 + ], "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": 28, + "second": 27, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "3923635B.85C58444@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------0BBC657DDC74A0B8454627FD" } - ], - [ - { - "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": 6292 }, { - "InlineBinary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "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_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } + { + "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": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1365, - "end": 1400 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1426, - "end": 1435 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 1455, - "end": 1491 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1365, + "end": 1400 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1426, + "end": 1435 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1455, + "end": 1491 + } + ] + ], + "is_encoding_problem": false, + "body": { + "InlineBinary": [ 137, 80, 78, @@ -1679,68 +1693,68 @@ Slow but steady wins the race. 66, 96, 130 - ], - "offset_header": 1352, - "offset_body": 1493, - "offset_end": 3309 - } + ] + }, + "offset_header": 1352, + "offset_body": 1493, + "offset_end": 3311 }, { - "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": 3364, - "end": 3400 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3426, - "end": 3435 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3455, - "end": 3492 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3364, + "end": 3400 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3426, + "end": 3435 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3455, + "end": 3492 + } + ] + ], + "is_encoding_problem": false, + "body": { + "InlineBinary": [ 137, 80, 78, @@ -3039,92 +3053,73 @@ Slow but steady wins the race. 66, 96, 130 - ], - "offset_header": 3351, - "offset_body": 3494, - "offset_end": 5274 - } + ] + }, + "offset_header": 3351, + "offset_body": 3494, + "offset_end": 5276 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii", - "name": "hareandtoroise.txt" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "hareandtoroise.txt" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "name": "hareandtoroise.txt", + "charset": "us-ascii" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 5329, - "end": 5389 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "hareandtoroise.txt" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 5415, - "end": 5422 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 5442, - "end": 5484 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5329, + "end": 5389 + } ], - "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": 5316, - "offset_body": 5486, - "offset_end": 6248 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5415, + "end": 5422 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5442, + "end": 5484 + } + ] + ], + "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": 5316, + "offset_body": 5486, + "offset_end": 6250 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - } - ] - }, - "offset_header": 0, - "offset_body": 378, - "offset_end": 6290 + ] } \ No newline at end of file diff --git a/tests/legacy/031.txt b/tests/legacy/031.txt index a4a8360..0935d73 100644 --- a/tests/legacy/031.txt +++ b/tests/legacy/031.txt @@ -96,238 +96,251 @@ Z3VldDZzO7wAAAAASUVORK5CYII= ---1463757054-952513540-958744548=:8452-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-952513540-958744548=:8452" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 9, - "minute": 55, - "second": 48, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "subject": { - "Text": "Test message from PINE" - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "date" - }, - { - "start": 5, - "end": 45 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 50, - "end": 91 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 94, - "end": 124 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 132, - "end": 157 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 168, - "end": 232 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 245, - "end": 251 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 264, - "end": 332 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "US-ASCII" - } - } + "headers_rfc": { + "subject": { + "Text": "Test message from PINE" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 608, - "end": 639 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 9, + "minute": 55, + "second": 48, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "-1463757054-952513540-958744548=:8452" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "date" + }, + { + "start": 5, + "end": 45 + } ], - "is_encoding_problem": false, - "body": "This is a test message from PINE MUA.\r\n\r\n", - "offset_header": 595, - "offset_body": 641, - "offset_end": 682 - } + [ + { + "Rfc": "from" + }, + { + "start": 50, + "end": 91 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 94, + "end": 124 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 132, + "end": 157 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 168, + "end": 232 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 245, + "end": 251 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 264, + "end": 332 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 334, + "offset_end": 5171 }, { - "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": "A PNG graphic file" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "redball.png" - } + { + "start": 608, + "end": 639 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "This is a test message from PINE MUA.\r\n\r\n" + }, + "offset_header": 595, + "offset_body": 641, + "offset_end": 684 + }, + { + "headers_rfc": { + "content_description": { + "Text": "A PNG graphic file" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "redball.png" } - }, - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_id": { - "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 738, - "end": 785 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 811, - "end": 820 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 831, - "end": 888 - } - ], - [ - { - "Rfc": "content_description" - }, - { - "start": 908, - "end": 929 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 949, - "end": 986 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 738, + "end": 785 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 811, + "end": 820 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 831, + "end": 888 + } + ], + [ + { + "Rfc": "content_description" + }, + { + "start": 908, + "end": 929 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 949, + "end": 986 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -1781,92 +1794,92 @@ Z3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 725, - "offset_body": 988, - "offset_end": 2992 - } + ] + }, + "offset_header": 725, + "offset_body": 988, + "offset_end": 2994 }, { - "Binary": { - "headers_rfc": { - "content_id": { - "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_description": { - "Text": "A PNG graphic file" - }, - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "blueball.png" - } + "headers_rfc": { + "content_description": { + "Text": "A PNG graphic file" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "blueball.png" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 3048, - "end": 3096 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 3122, - "end": 3131 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 3142, - "end": 3199 - } - ], - [ - { - "Rfc": "content_description" - }, - { - "start": 3219, - "end": 3240 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 3260, - "end": 3298 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3048, + "end": 3096 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3122, + "end": 3131 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 3142, + "end": 3199 + } + ], + [ + { + "Rfc": "content_description" + }, + { + "start": 3219, + "end": 3240 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3260, + "end": 3298 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 137, 80, 78, @@ -3192,27 +3205,11 @@ Z3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ], - "offset_header": 3035, - "offset_body": 3300, - "offset_end": 5126 - } + ] + }, + "offset_header": 3035, + "offset_body": 3300, + "offset_end": 5128 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 334, - "offset_end": 5169 + ] } \ No newline at end of file diff --git a/tests/legacy/032.txt b/tests/legacy/032.txt index 07e1393..e28d275 100644 --- a/tests/legacy/032.txt +++ b/tests/legacy/032.txt @@ -133,320 +133,338 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 8, - "second": 29, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------C78F594988075E36AE03C243" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "message_id": { - "Text": "39235EAD.E48E2160@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@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": [ - 2, 3, - 4 + 4, + 5 ], "text_body": [ - 1, - 3, - 4 + 2, + 4, + 5 ], "attachments": [ - 3, - 4 + 4, + 5 ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "------------D74AE2393FB01D1B284AE257" - } - } + "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": 552 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 8, + "second": 29, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "39235EAD.E48E2160@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------C78F594988075E36AE03C243" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 45 + } ], - "offset_header": 464, - "offset_body": 554, - "offset_end": 2600 - } + [ + { + "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, + 4, + 5 + ] + }, + "offset_header": 0, + "offset_body": 378, + "offset_end": 6608 }, { - "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": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "------------D74AE2393FB01D1B284AE257" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 609, - "end": 642 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 668, - "end": 687 - } - ] - ], - "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": 596, - "offset_body": 689, - "offset_end": 1487 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 552 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 3 + ] + }, + "offset_header": 464, + "offset_body": 554, + "offset_end": 2600 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1542, - "end": 1572 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1598, - "end": 1605 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 609, + "end": 642 + } ], - "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": 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\"blue\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\"blue\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\"blue\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

\"red\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\"blue\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

\"red\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
 \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-:\\ZMSMZESN]:C.\\0,9Q:A-:MUN?.[^^,O>]*>^\\8.:482L:,\r\nMO>>UY^^4O>\\``\"E:C.=SI>]KG.\\(*8PQ8^\\I6N\\((7L`````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#!\r\nM,@U5`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```&(241!5'B<==)M5YLP& ;@$DZ )A!2DX;,\"4RG!2+:JHO;K&_;\r\nM?/G_ORA[TE;LL<>;+YQSG3LAY!F-A@0H1\"APHYT$.(HA48+#CXS'A*80DK$H\r\nM0=OHT(*,54I*9+0#>J23(LO^U\\/RJJ64PV(!L1,[WT[//I^?#)K6MGI\r\nM+#)O>P8QG>P?GO:G9^?SIFP7BC\"\\*;J$:W%QV??]U8]Y4]7\"4I:#>0PB,I'7\r\nM/_O^U^^;65/60H&%:PMCNKR]OKN_?_\"U5B[>S3T66I0'?_[^N_&[U:+3A*_,\r\nMC1QF3Z*=S9]?&D]R:M,L3@9+EW75@%1 \"ZLIC_UW>GLLJ)5M65:W-=!2:<+\\\r\nM^59F8J*F==U\"28H.B,.2&PMSEJJE%%(N.JOT:U9$9K4D6(\"++%6VZZRU*O6$\r\nMUS5_B# 'U$HIG5+\"BR@9\"(HF'W-\"*7TEG(^!UBNNS\"&3QP7CG#.X=[-I;7XV\r\nM8))'D!PF`FV3QP`9@XT)W^7M;OUK@. 9P&T-Q6ZVI^E3^8B[X[L#_P$45,S8\r\nMF6D.OP```\"5T15AT0V]M;65N= !C;&EP,F=I9B!V+C N-B!B>2!9=F5S(%!I\r\n49W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 greenball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM````$ ``& ``(0``\" ``,0``0@``4@``6@``2@`(8P`(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&KRU;5>]/60`]SX,0^'\\8HC[&`29]Y('?:!&F+.2<\r\nMAR(@R.NVVF@02C4<#N-8#:LMN[^]G#XU-FDB)VC_PW8#K614(E9K+_6\\Z7)DR)5\r\nM&]$:$C(QV7R9F9)&BH>4:+^V`8\\38\\HF1ZGD+*AN[TSC4*5)7LIWJN2V#52)\r\nM6-AWSS)*\"R>Q(T9Q!/W:?$T$ERJ.E9)RP\\KW!$V2%B)\"RQ XWX2\"D@ZY1A=>\r\nM0!EC0M\"@W]+6K ]T1##&U$6K84.VWA,`-4*11EZU$YV]<1^^#V&Y+*TTV=K_\r\nMJK>-T@@L+ ```\"5T15AT0V]M;65N= !C;&EP,F=I\r\nF9B!V+C N-B!B>2!9=F5S(%!I9W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 redball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM```!```+```5```:```7```1```*```#```<```R``!$``!-``!(```]```C\r\nM```6```F``!A``![``\"&``\"'``!]``!T``!@```Y```4```&```G``!+``!O\r\nM``\"0``\"E``\"[``\"_``\"K``\"A``\",``!S``!;```N```(``!,``!W``\"9``\"T\r\nM&1G*.#C5/3W;*2G=!06X``\"H``!Y```Q```8```$``!%``\":``\"[)\"3186'?\r\nMA(3F?W_F5E;J'Q_2``\"Y``\"C``!=``!\"```H```)``!G``\"Z#P_05%3>DY/E\r\nMK*SIF9GM967O)277``#!``\"Q``\"<``!M``!3```V```;```%``!*``\"!``#+\r\nM(\"#=9V?HG)SKIJ;MBHKO45'O%!31``##``\"V``!X``!>``! ```B``!7``\"2\r\nM``#\"``#:&QOH557L>'CO>'CO5U?O)B;A``#.``\"W``\"G``\"5``!'```K```/\r\nM``\"=``#%``#A!07K*\"CO/#SO-37O&QOC``#0``#)``\"U``\"7``\"$``!L``!/\r\nM```2```\"``!B``#I``#O`@+G``#8``#+``\"Z``\"P``!P```3```D``!8``#(\r\nM``#3``#-``\"S``\"#``!N```>``!^``# ``\"D``\"-``!_``!I``!0```P``\"1\r\nM``\"I``\"\\``\"J``\";``!E``!)```J```.```T``\"L``\"O``\"M``\"F``\")``!Z\r\nM``!K``!:```^```I``!J``\"\"``\"?``\">``\"6``\"/``!\\```9```'``!5``\".\r\nM``\"*```X```0```_``!R``\" ``!<```W```L``!F``!#``!6```@```S```\\\r\nM```Z```?```,```=```-````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#\\\r\nM+ME%`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```((241!5'B<8V\" @_\\0P( !F)A96%G9V#DX,:4YN+AY>'GY^+D%\r\nM!#E0)?\\S\"_$(BXB*B4M(\\DH)2?D%A47%R26E9E$=Y1258[C^3D&15=4UM77U#8U.SJWW[10_(IZTQ.W@($E7_+;BD#F\\3WZ*P;-F1H[.WSI'D/29P'!J+__\\?\r\nMESUQV..DR*)3B[:J;SNM?49(V@(N%\\%VEK_#Y=PV^?9=PIE\\85.E(^\")X_]_\r\nMCH.R8>=Y0S,OA&JGFV5T6B\"EF___#TE?7'M)ZO+E*]P[KQ[O0DY20);%M2FL\r\nMUR]>O7B=[09:<@.QF2QDM-S=M2PP4^)_5(\":\"/%(84W7`)A(.MC?YL?R````\r\nM)71%6'1#;VUM96YT`&-L:7 R9VEF('8N,\"XV(&)Y(%EV97,@4&EG=65T-G,[\r\n-O ````!)14Y$KD)@@@``\r\n`\r\nend\r\n\r", - "offset_header": 0, - "offset_body": 418, - "offset_end": 7002 - } + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "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 + } + ] + ], + "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\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-:\\ZMSMZESN]:C.\\0,9Q:A-:MUN?.[^^,O>]*>^\\8.:482L:,\r\nMO>>UY^^4O>\\``\"E:C.=SI>]KG.\\(*8PQ8^\\I6N\\((7L`````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#!\r\nM,@U5`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```&(241!5'B<==)M5YLP& ;@$DZ )A!2DX;,\"4RG!2+:JHO;K&_;\r\nM?/G_ORA[TE;LL<>;+YQSG3LAY!F-A@0H1\"APHYT$.(HA48+#CXS'A*80DK$H\r\nM0=OHT(*,54I*9+0#>J23(LO^U\\/RJJ64PV(!L1,[WT[//I^?#)K6MGI\r\nM+#)O>P8QG>P?GO:G9^?SIFP7BC\"\\*;J$:W%QV??]U8]Y4]7\"4I:#>0PB,I'7\r\nM/_O^U^^;65/60H&%:PMCNKR]OKN_?_\"U5B[>S3T66I0'?_[^N_&[U:+3A*_,\r\nMC1QF3Z*=S9]?&D]R:M,L3@9+EW75@%1 \"ZLIC_UW>GLLJ)5M65:W-=!2:<+\\\r\nM^59F8J*F==U\"28H.B,.2&PMSEJJE%%(N.JOT:U9$9K4D6(\"++%6VZZRU*O6$\r\nMUS5_B# 'U$HIG5+\"BR@9\"(HF'W-\"*7TEG(^!UBNNS\"&3QP7CG#.X=[-I;7XV\r\nM8))'D!PF`FV3QP`9@XT)W^7M;OUK@. 9P&T-Q6ZVI^E3^8B[X[L#_P$45,S8\r\nMF6D.OP```\"5T15AT0V]M;65N= !C;&EP,F=I9B!V+C N-B!B>2!9=F5S(%!I\r\n49W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 greenball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM````$ ``& ``(0``\" ``,0``0@``4@``6@``2@`(8P`(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&KRU;5>]/60`]SX,0^'\\8HC[&`29]Y('?:!&F+.2<\r\nMAR(@R.NVVF@02C4<#N-8#:LMN[^]G#XU-FDB)VC_PW8#K614(E9K+_6\\Z7)DR)5\r\nM&]$:$C(QV7R9F9)&BH>4:+^V`8\\38\\HF1ZGD+*AN[TSC4*5)7LIWJN2V#52)\r\nM6-AWSS)*\"R>Q(T9Q!/W:?$T$ERJ.E9)RP\\KW!$V2%B)\"RQ XWX2\"D@ZY1A=>\r\nM0!EC0M\"@W]+6K ]T1##&U$6K84.VWA,`-4*11EZU$YV]<1^^#V&Y+*TTV=K_\r\nMJK>-T@@L+ ```\"5T15AT0V]M;65N= !C;&EP,F=I\r\nF9B!V+C N-B!B>2!9=F5S(%!I9W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 redball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM```!```+```5```:```7```1```*```#```<```R``!$``!-``!(```]```C\r\nM```6```F``!A``![``\"&``\"'``!]``!T``!@```Y```4```&```G``!+``!O\r\nM``\"0``\"E``\"[``\"_``\"K``\"A``\",``!S``!;```N```(``!,``!W``\"9``\"T\r\nM&1G*.#C5/3W;*2G=!06X``\"H``!Y```Q```8```$``!%``\":``\"[)\"3186'?\r\nMA(3F?W_F5E;J'Q_2``\"Y``\"C``!=``!\"```H```)``!G``\"Z#P_05%3>DY/E\r\nMK*SIF9GM967O)277``#!``\"Q``\"<``!M``!3```V```;```%``!*``\"!``#+\r\nM(\"#=9V?HG)SKIJ;MBHKO45'O%!31``##``\"V``!X``!>``! ```B``!7``\"2\r\nM``#\"``#:&QOH557L>'CO>'CO5U?O)B;A``#.``\"W``\"G``\"5``!'```K```/\r\nM``\"=``#%``#A!07K*\"CO/#SO-37O&QOC``#0``#)``\"U``\"7``\"$``!L``!/\r\nM```2```\"``!B``#I``#O`@+G``#8``#+``\"Z``\"P``!P```3```D``!8``#(\r\nM``#3``#-``\"S``\"#``!N```>``!^``# ``\"D``\"-``!_``!I``!0```P``\"1\r\nM``\"I``\"\\``\"J``\";``!E``!)```J```.```T``\"L``\"O``\"M``\"F``\")``!Z\r\nM``!K``!:```^```I``!J``\"\"``\"?``\">``\"6``\"/``!\\```9```'``!5``\".\r\nM``\"*```X```0```_``!R``\" ``!<```W```L``!F``!#``!6```@```S```\\\r\nM```Z```?```,```=```-````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#\\\r\nM+ME%`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```((241!5'B<8V\" @_\\0P( !F)A96%G9V#DX,:4YN+AY>'GY^+D%\r\nM!#E0)?\\S\"_$(BXB*B4M(\\DH)2?D%A47%R26E9E$=Y1258[C^3D&15=4UM77U#8U.SJWW[10_(IZTQ.W@($E7_+;BD#F\\3WZ*P;-F1H[.WSI'D/29P'!J+__\\?\r\nMESUQV..DR*)3B[:J;SNM?49(V@(N%\\%VEK_#Y=PV^?9=PIE\\85.E(^\")X_]_\r\nMCH.R8>=Y0S,OA&JGFV5T6B\"EF___#TE?7'M)ZO+E*]P[KQ[O0DY20);%M2FL\r\nMUR]>O7B=[09:<@.QF2QDM-S=M2PP4^)_5(\":\"/%(84W7`)A(.MC?YL?R````\r\nM)71%6'1#;VUM96YT`&-L:7 R9VEF('8N,\"XV(&)Y(%EV97,@4&EG=65T-G,[\r\n-O ````!)14Y$KD)@@@``\r\n`\r\nend\r\n\r" + }, + "offset_header": 0, + "offset_body": 418, + "offset_end": 7002 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 418, - "offset_end": 7002 + ] } \ No newline at end of file diff --git a/tests/legacy/050.txt b/tests/legacy/050.txt index 98519a0..5c9c46e 100644 --- a/tests/legacy/050.txt +++ b/tests/legacy/050.txt @@ -109,266 +109,279 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "=====================_715546120==_.REL", - "type": "text/html" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 39, - "second": 36, - "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": 508 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "parts": [ { - "Html": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "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": 565, - "end": 599 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 39, + "second": 36, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "text/html", + "boundary": "=====================_715546120==_.REL" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 625, - "end": 644 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "message_id" + }, + { + "start": 11, + "end": 64 + } ], - "is_encoding_problem": false, - "body": "\n\"2aa658b6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"2aa658c0.png\"
\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\"2aa658b6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die 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\"2aa658c0.png\"
\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 enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n", - "offset_header": 1387, - "offset_body": 1416, - "offset_end": 1556 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 1590, - "end": 1606 - } - ] - ], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "to": { - "Address": { - "name": "address in US-ASCII", - "address": null - } - }, - "subject": { - "Text": "(subject in US-ASCII)" - }, - "from": { - "Address": { - "name": "mailbox in US-ASCII", - "address": null - } - } + [ + { + "Rfc": "to" }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 1612, - "end": 1635 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 1638, - "end": 1661 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 1669, - "end": 1692 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 1705, - "end": 1737 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1763, - "end": 1781 - } - ] - ], + { + "start": 65, + "end": 95 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 100, + "end": 139 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 147, + "end": 168 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 181, + "end": 238 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3, + 6, + 7 + ] + }, + "offset_header": 0, + "offset_body": 239, + "offset_end": 1853 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Text": "... 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": 794 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "US-ASCII" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 827, + "end": 857 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "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": 970 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "parallel", + "attributes": { + "boundary": "unique-boundary-2" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1003, + "end": 1051 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 4, + 5 + ] + }, + "offset_header": 990, + "offset_body": 1052, + "offset_end": 1366 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "audio", + "c_subtype": "basic", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1085, + "end": 1098 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1124, + "end": 1132 + } + ] + ], + "is_encoding_problem": true, + "body": { + "Text": "... base64-encoded 8000 Hz single-channel\n mu-law-format audio data goes here ...\n" + }, + "offset_header": 1072, + "offset_body": 1133, + "offset_end": 1219 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1252, + "end": 1264 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1290, + "end": 1298 + } + ] + ], + "is_encoding_problem": true, + "body": { + "Text": "... base64-encoded image data goes here ...\n" + }, + "offset_header": 1239, + "offset_body": 1299, + "offset_end": 1344 + }, + { + "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": { + "Text": "This is enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n" + }, + "offset_header": 1387, + "offset_body": 1416, + "offset_end": 1557 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1590, + "end": 1606 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ 0 ], @@ -472,92 +428,49 @@ Content-Transfer-Encoding: Quoted-printable "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": { + "from": { + "Address": { + "name": "mailbox in US-ASCII", + "address": null + } + }, + "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": 1705, - "end": 1737 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1763, - "end": 1781 - } - ] - ], - "is_encoding_problem": false, - "body": "... Additional text in ISO-8859-1 goes here ...\n", - "offset_header": 1607, - "offset_body": 1782, - "offset_end": 1830 - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 1607, - "offset_body": 1782, - "offset_end": 1830 - }, - "offset_header": 1577, - "offset_body": 1607, - "offset_end": 1830 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "MultiPart": [ - 2, - [ - { - "Part": 3 - }, - { - "Part": 4 + "to": { + "Address": { + "name": "address in US-ASCII", + "address": null + } + }, + "subject": { + "Text": "(subject in US-ASCII)" + } + }, + "is_encoding_problem": false, + "body": { + "Text": "... Additional text in ISO-8859-1 goes here ...\n" + }, + "offset_header": 1607, + "offset_body": 1782, + "offset_end": 1831 } ] - ] + } }, - { - "Part": 5 - }, - { - "Part": 6 - } - ] - }, - "offset_header": 0, - "offset_body": 239, - "offset_end": 1852 + "offset_header": 1577, + "offset_body": 1607, + "offset_end": 1831 + } + ] } \ No newline at end of file diff --git a/tests/rfc/001.txt b/tests/rfc/001.txt index 2b41f71..e50ec40 100644 --- a/tests/rfc/001.txt +++ b/tests/rfc/001.txt @@ -40,154 +40,167 @@ get RFC-MIME.DOC ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": "Whomever", - "address": null - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "id1@host.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "42" - } - } - }, - "content_id": { - "Text": "id001@guppylake.bellcore.com" - }, - "subject": { - "Text": "whatever" - }, - "to": { - "Address": { - "name": "Someone", - "address": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 15 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 18, - "end": 27 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 32, - "end": 42 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 50, - "end": 60 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 73, - "end": 78 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 89, - "end": 105 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 118, - "end": 154 - } - ], - [ - { - "Rfc": "content_id" - }, - { - "start": 165, - "end": 197 - } - ] - ], "html_body": [], "text_body": [], "attachments": [ - 0, 1, - 2 + 2, + 3 ], "parts": [ { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "access-type": "ANON-FTP", - "mode": "image", - "name": "BodyFormats.ps", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "site": "thumper.bellcore.com", - "directory": "pub" - } - } + "headers_rfc": { + "subject": { + "Text": "whatever" + }, + "from": { + "Address": { + "name": "Whomever", + "address": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 216, - "end": 432 + "to": { + "Address": { + "name": "Someone", + "address": null + } + }, + "message_id": { + "Text": "id1@host.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_id": { + "Text": "id001@guppylake.bellcore.com" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "42" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 15 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "to" + }, + { + "start": 18, + "end": 27 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 32, + "end": 42 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 50, + "end": 60 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 73, + "end": 78 + } + ], + [ + { + "Rfc": "message_id" + }, + { + "start": 89, + "end": 105 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 118, + "end": 154 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 165, + "end": 197 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 198, + "offset_end": 1107 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "directory": "pub", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "site": "thumper.bellcore.com", + "access-type": "ANON-FTP", + "name": "BodyFormats.ps", + "mode": "image" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 216, + "end": 432 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 67, 111, 110, @@ -267,41 +280,41 @@ get RFC-MIME.DOC 109, 62, 10 - ], - "offset_header": 203, - "offset_body": 433, - "offset_end": 512 - } + ] + }, + "offset_header": 203, + "offset_body": 433, + "offset_end": 513 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "access-type": "local-file", - "name": "/u/nsb/writing/rfcs/RFC-MIME.ps", - "site": "thumper.bellcore.com" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "access-type": "local-file", + "site": "thumper.bellcore.com", + "name": "/u/nsb/writing/rfcs/RFC-MIME.ps", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 531, - "end": 735 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 531, + "end": 735 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 67, 111, 110, @@ -381,40 +394,40 @@ get RFC-MIME.DOC 109, 62, 10 - ], - "offset_header": 518, - "offset_body": 736, - "offset_end": 815 - } + ] + }, + "offset_header": 518, + "offset_body": 736, + "offset_end": 816 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "server": "listserv@bogus.bitnet", - "access-type": "mail-server" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "access-type": "mail-server", + "server": "listserv@bogus.bitnet", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 834, - "end": 1001 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 834, + "end": 1001 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 67, 111, 110, @@ -512,27 +525,11 @@ get RFC-MIME.DOC 79, 67, 10 - ], - "offset_header": 821, - "offset_body": 1002, - "offset_end": 1099 - } + ] + }, + "offset_header": 821, + "offset_body": 1002, + "offset_end": 1100 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 198, - "offset_end": 1106 + ] } \ No newline at end of file diff --git a/tests/rfc/002.txt b/tests/rfc/002.txt index fc83684..4fdf3f0 100644 --- a/tests/rfc/002.txt +++ b/tests/rfc/002.txt @@ -72,436 +72,319 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz --D7F------------D7FD5A0B8AB9C65CCDBFA872-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" - } - } - }, - "from": { - "Address": { - "name": "Al Gore", - "address": "vice-president@whitehouse.gov" - } - }, - "subject": { - "Text": "[Fwd: Map of Argentina with Description]" - }, - "to": { - "Address": { - "name": "White House Transportation Coordinator", - "address": "transport@whitehouse.gov" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 47 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 50, - "end": 123 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 131, - "end": 173 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 186, - "end": 269 - } - ] - ], "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": "[Fwd: Map of Argentina with Description]" + }, + "from": { + "Address": { + "name": "Al Gore", + "address": "vice-president@whitehouse.gov" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 370, - "end": 400 + "to": { + "Address": { + "name": "White House Transportation Coordinator", + "address": "transport@whitehouse.gov" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 426, - "end": 432 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 47 + } ], - "is_encoding_problem": false, - "body": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl", - "offset_header": 357, - "offset_body": 433, - "offset_end": 494 - } + [ + { + "Rfc": "to" + }, + { + "start": 50, + "end": 123 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 131, + "end": 173 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 186, + "end": 269 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 270, + "offset_end": 2651 }, { - "Message": { - "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null + "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_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } + { + "start": 370, + "end": 400 + } + ], + [ + { + "Rfc": "content_transfer_encoding" }, - "content_transfer_encoding": { - "Text": "7bit" + { + "start": 426, + "end": 432 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl" + }, + "offset_header": 357, + "offset_body": 433, + "offset_end": 495 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 550, - "end": 566 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 592, - "end": 598 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 618, - "end": 626 - } - ] - ], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "return_path": { - "Text": "president@whitehouse.gov" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "A1 Gore (The Enforcer)", - "address": "vice-president@whitehouse.gov" - } - }, - "subject": { - "Text": "Map of Argentina with Description" - }, - "received": { - "Collection": [ - { - "Text": "from mailhost.whitehouse.gov ([192.168.51.200])\n by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453\n for ;\n Mon, 13 Aug 1998 l8:14:23 +1000" - }, - { - "Text": "from the_big_box.whitehouse.gov ([192.168.51.50])\n by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366\n for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000" - } - ] - }, - "message_id": { - "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "DC8------------DC8638F443D87A7F0726DEF7" - } - } - }, - "date": { - "DateTime": { - "year": 1998, - "month": 8, - "day": 13, - "hour": 17, - "minute": 42, - "second": 41, - "tz_before_gmt": false, - "tz_hour": 10, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Bill Clinton", - "address": "president@whitehouse.gov" - } - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "headers_raw": [ - [ - { - "Rfc": "return_path" - }, - { - "start": 639, - "end": 667 - } - ], - [ - { - "Rfc": "received" - }, - { - "start": 676, - "end": 893 - } - ], - [ - { - "Rfc": "received" - }, - { - "start": 902, - "end": 1100 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 1105, - "end": 1138 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 1149, - "end": 1198 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 1203, - "end": 1244 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 1247, - "end": 1303 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 1311, - "end": 1347 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 1360, - "end": 1365 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 1378, - "end": 1461 - } - ] - ], + { + "start": 550, + "end": 566 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 592, + "end": 598 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 618, + "end": 626 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Message": { "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": { + "date": { + "DateTime": { + "year": 1998, + "month": 8, + "day": 13, + "hour": 17, + "minute": 42, + "second": 41, + "tz_before_gmt": false, + "tz_hour": 10, + "tz_minute": 0 } }, - "headers_raw": [ - [ + "received": { + "Collection": [ { - "Rfc": "content_type" + "Text": "from mailhost.whitehouse.gov ([192.168.51.200])\n by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453\n for ;\n Mon, 13 Aug 1998 l8:14:23 +1000" }, { - "start": 1562, - "end": 1592 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 1618, - "end": 1624 + "Text": "from the_big_box.whitehouse.gov ([192.168.51.50])\n by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366\n for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000" } ] - ], - "is_encoding_problem": false, - "body": "Hi A1,\n\nI finally figured out this MIME thing. Pretty cool. I'll send you\nsome sax music in .au files next week!\n\nAnyway, the attached image is really too small to get a good look at\nArgentina. Try this for a much better map:\n\n http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm\n\nThen again, shouldn't the CIA have something like that?\n\nBill", - "offset_header": 1549, - "offset_body": 1625, - "offset_end": 1980 - } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Map of Argentina with Description" + }, + "message_id": { + "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" + }, + "return_path": { + "Text": "president@whitehouse.gov" + }, + "to": { + "Address": { + "name": "A1 Gore (The Enforcer)", + "address": "vice-president@whitehouse.gov" + } + }, + "from": { + "Address": { + "name": "Bill Clinton", + "address": "president@whitehouse.gov" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "DC8------------DC8638F443D87A7F0726DEF7" + } + } + } + }, + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 627, + "offset_body": 1462, + "offset_end": 2606 }, { - "InlineBinary": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "fi1ename": "map_of_Argentina.gif" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "gif", - "attributes": { - "name": "map_of_Argentina.gif" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 2036, - "end": 2076 + "content_transfer_encoding": { + "Text": "7bit" + } + }, + "is_encoding_problem": false, + "body": { + "Text": "Hi A1,\n\nI finally figured out this MIME thing. Pretty cool. I'll send you\nsome sax music in .au files next week!\n\nAnyway, the attached image is really too small to get a good look at\nArgentina. Try this for a much better map:\n\n http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm\n\nThen again, shouldn't the CIA have something like that?\n\nBill" + }, + "offset_header": 1549, + "offset_body": 1625, + "offset_end": 1981 + }, + { + "headers_rfc": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "fi1ename": "map_of_Argentina.gif" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 2102, - "end": 2110 + } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "gif", + "attributes": { + "name": "map_of_Argentina.gif" } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 2130, - "end": 2171 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "content_transfer_encoding": { + "Text": "base64" + } + }, + "is_encoding_problem": false, + "body": { + "InlineBinary": [ 71, 77, 70, @@ -790,44 +673,18 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz 0, 0, 59 - ], - "offset_header": 2023, - "offset_body": 2172, - "offset_end": 2561 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + ] }, - { - "Part": 1 - } - ] - }, - "offset_header": 627, - "offset_body": 1462, - "offset_end": 2606 - }, - "offset_header": 537, - "offset_body": 627, - "offset_end": 2606 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + "offset_header": 2023, + "offset_body": 2172, + "offset_end": 2562 + } + ] + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 270, - "offset_end": 2650 + "offset_header": 537, + "offset_body": 627, + "offset_end": 2607 + } + ] } \ No newline at end of file diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index c485282..bfb5f42 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -24,199 +24,212 @@ Content-Type: application/x-whatever --boundary42-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary42" - } - } - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 22, - "hour": 9, - "minute": 41, - "second": 9, - "tz_before_gmt": true, - "tz_hour": 8, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Formatted text mail" - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 46 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 49, - "end": 79 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 84, - "end": 123 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 131, - "end": 152 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 165, - "end": 170 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 183, - "end": 227 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 1, - 2 + 2, + 3 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } + "headers_rfc": { + "subject": { + "Text": "Formatted text mail" + }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 254, - "end": 284 + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 22, + "hour": 9, + "minute": 41, + "second": 9, + "tz_before_gmt": true, + "tz_hour": 8, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary42" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 46 + } ], - "is_encoding_problem": false, - "body": "... plain text version of message goes here ...\n", - "offset_header": 241, - "offset_body": 285, - "offset_end": 333 - } + [ + { + "Rfc": "to" + }, + { + "start": 49, + "end": 79 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 84, + "end": 123 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 131, + "end": 152 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 165, + "end": 170 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 183, + "end": 227 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 228, + "offset_end": 564 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "enriched", - "attributes": null + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 360, - "end": 375 - } - ] - ], - "is_encoding_problem": false, - "body": "... RFC 1896 text/enriched version of same message\n goes here ...\n", - "offset_header": 347, - "offset_body": 376, - "offset_end": 445 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 254, + "end": 284 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "... plain text version of message goes here ...\n" + }, + "offset_header": 241, + "offset_body": 285, + "offset_end": 334 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "x-whatever", - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "enriched", + "attributes": null } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 472, - "end": 496 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 360, + "end": 375 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "... RFC 1896 text/enriched version of same message\n goes here ...\n" + }, + "offset_header": 347, + "offset_body": 376, + "offset_end": 446 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "x-whatever", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 472, + "end": 496 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 46, 46, 46, @@ -268,27 +281,11 @@ Content-Type: application/x-whatever 46, 46, 10 - ], - "offset_header": 459, - "offset_body": 497, - "offset_end": 548 - } + ] + }, + "offset_header": 459, + "offset_body": 497, + "offset_end": 549 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 228, - "offset_end": 563 + ] } \ No newline at end of file diff --git a/tests/rfc/004.txt b/tests/rfc/004.txt index 7d64c72..733fe71 100644 --- a/tests/rfc/004.txt +++ b/tests/rfc/004.txt @@ -35,399 +35,303 @@ Subject: my different opinion ------ main boundary ------ ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Moderator-Address", - "address": null - } - }, - "subject": { - "Text": "Internet Digest, volume 42" - }, - "date": { - "DateTime": { - "year": 1994, - "month": 3, - "day": 22, - "hour": 13, - "minute": 34, - "second": 51, - "tz_before_gmt": false, - "tz_hour": 0, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "---- main boundary ----" - } - } - }, - "to": { - "Address": { - "name": "Recipient-List", - "address": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 24 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 27, - "end": 43 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 48, - "end": 81 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 89, - "end": 117 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 130, - "end": 135 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 148, - "end": 213 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [ - 2, - 3 + 3, + 4 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } + "headers_rfc": { + "subject": { + "Text": "Internet Digest, volume 42" + }, + "from": { + "Address": { + "name": "Moderator-Address", + "address": null } }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "...Introductory text or table of contents...\n", - "offset_header": 240, - "offset_body": 241, - "offset_end": 286 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "digest", - "attributes": { - "boundary": "---- next message ----" - } - } + "to": { + "Address": { + "name": "Recipient-List", + "address": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 326, - "end": 391 - } - ] - ], - "offset_header": 313, - "offset_body": 392, - "offset_end": 698 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } + "date": { + "DateTime": { + "year": 1994, + "month": 3, + "day": 22, + "hour": 13, + "minute": 34, + "second": 51, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 } }, - "headers_raw": [], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 11, - "minute": 13, - "second": 32, - "tz_before_gmt": false, - "tz_hour": 2, - "tz_minute": 0 - } - }, - "subject": { - "Text": "my opinion" - }, - "from": { - "Address": { - "name": "someone-else", - "address": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 423, - "end": 437 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 442, - "end": 475 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 483, - "end": 495 - } - ] - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "attachments": [], - "parts": [ - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "...body goes here ...\n", - "offset_header": 418, - "offset_body": 496, - "offset_end": 518 - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 418, - "offset_body": 496, - "offset_end": 518 + "mime_version": { + "Text": "1.0" }, - "offset_header": 417, - "offset_body": 418, - "offset_end": 518 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "---- main boundary ----" } } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "from": { - "Address": { - "name": "someone-else-again", - "address": null - } - }, - "subject": { - "Text": "my different opinion" - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 10, - "minute": 7, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 5, - "tz_minute": 0 - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 550, - "end": 570 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 575, - "end": 608 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 616, - "end": 638 - } - ] - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "attachments": [], - "parts": [ - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "... another body goes here ...\n", - "offset_header": 545, - "offset_body": 639, - "offset_end": 670 - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 545, - "offset_body": 639, - "offset_end": 670 - }, - "offset_header": 544, - "offset_body": 545, - "offset_end": 670 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + } }, - { - "MultiPart": [ + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 24 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 27, + "end": 43 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 48, + "end": 81 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 89, + "end": 117 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 130, + "end": 135 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 148, + "end": 213 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ 1, - [ + 2 + ] + }, + "offset_header": 0, + "offset_body": 214, + "offset_end": 727 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Text": "...Introductory text or table of contents...\n" + }, + "offset_header": 240, + "offset_body": 241, + "offset_end": 287 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "digest", + "attributes": { + "boundary": "---- next message ----" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 391 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 4 + ] + }, + "offset_header": 313, + "offset_body": 392, + "offset_end": 698 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Message": { + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "attachments": [], + "parts": [ { - "Part": 2 - }, - { - "Part": 3 + "headers_rfc": { + "from": { + "Address": { + "name": "someone-else", + "address": null + } + }, + "subject": { + "Text": "my opinion" + }, + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 11, + "minute": 13, + "second": 32, + "tz_before_gmt": false, + "tz_hour": 2, + "tz_minute": 0 + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "...body goes here ...\n" + }, + "offset_header": 418, + "offset_body": 496, + "offset_end": 519 } ] - ] - } - ] - }, - "offset_header": 0, - "offset_body": 214, - "offset_end": 726 + } + }, + "offset_header": 417, + "offset_body": 418, + "offset_end": 519 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Message": { + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "attachments": [], + "parts": [ + { + "headers_rfc": { + "subject": { + "Text": "my different opinion" + }, + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 10, + "minute": 7, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 + } + }, + "from": { + "Address": { + "name": "someone-else-again", + "address": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "... another body goes here ...\n" + }, + "offset_header": 545, + "offset_body": 639, + "offset_end": 671 + } + ] + } + }, + "offset_header": 544, + "offset_body": 545, + "offset_end": 671 + } + ] } \ No newline at end of file diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index fe8f26f..5ee1369 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -24,176 +24,175 @@ It DOES end with a linebreak. This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 21, - "hour": 23, - "minute": 56, - "second": 48, - "tz_before_gmt": true, - "tz_hour": 8, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "simple boundary" - } - } - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "subject": { - "Text": "Sample message" - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 46 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 49, - "end": 79 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 84, - "end": 123 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 131, - "end": 147 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 160, - "end": 165 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 178, - "end": 223 - } - ] - ], "html_body": [ - 0, - 1 + 1, + 2 ], "text_body": [ - 0, - 1 + 1, + 2 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } + "headers_rfc": { + "subject": { + "Text": "Sample message" + }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" } }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak.", - "offset_header": 400, - "offset_body": 401, - "offset_end": 480 - } + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 21, + "hour": 23, + "minute": 56, + "second": 48, + "tz_before_gmt": true, + "tz_hour": 8, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "simple boundary" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 46 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 49, + "end": 79 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 84, + "end": 123 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 131, + "end": 147 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 160, + "end": 165 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 178, + "end": 223 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 224, + "offset_end": 640 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Text": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak." + }, + "offset_header": 400, + "offset_body": 401, + "offset_end": 481 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 512, - "end": 542 - } - ] - ], - "is_encoding_problem": false, - "body": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n", - "offset_header": 499, - "offset_body": 543, - "offset_end": 619 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 224, - "offset_end": 639 + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 512, + "end": 542 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n" + }, + "offset_header": 499, + "offset_body": 543, + "offset_end": 620 + } + ] } \ No newline at end of file diff --git a/tests/rfc/006.txt b/tests/rfc/006.txt index 0777fed..d9bf54c 100644 --- a/tests/rfc/006.txt +++ b/tests/rfc/006.txt @@ -22,208 +22,207 @@ Content-Disposition: inline --boundary-string-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "from": { - "Address": { - "name": null, - "address": "sender@example.com" - } - }, - "subject": { - "Text": "Multipart Email Example" - }, - "to": { - "Address": { - "name": null, - "address": "recipient@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary-string" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 25 - } - ], - [ - { - "Rfc": "to" - }, - { - "start": 28, - "end": 51 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 59, - "end": 84 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 97, - "end": 148 - } - ] - ], "html_body": [ - 1 + 2 ], "text_body": [ - 0 + 1 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "headers_rfc": { + "subject": { + "Text": "Multipart Email Example" + }, + "from": { + "Address": { + "name": null, + "address": "sender@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 180, - "end": 209 + "to": { + "Address": { + "name": null, + "address": "recipient@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary-string" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 235, - "end": 253 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 273, - "end": 281 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 25 + } ], - "is_encoding_problem": false, - "body": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n", - "offset_header": 167, - "offset_body": 282, - "offset_end": 369 - } + [ + { + "Rfc": "to" + }, + { + "start": 28, + "end": 51 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 59, + "end": 84 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 97, + "end": 148 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 149, + "offset_end": 616 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "utf-8" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 401, - "end": 429 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 455, - "end": 473 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 493, - "end": 501 - } - ] - ], - "is_encoding_problem": false, - "body": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n", - "offset_header": 388, - "offset_body": 502, - "offset_end": 595 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 149, - "offset_end": 615 + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 180, + "end": 209 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 235, + "end": 253 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 273, + "end": 281 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n" + }, + "offset_header": 167, + "offset_body": 282, + "offset_end": 370 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "utf-8" + } + } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 401, + "end": 429 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 455, + "end": 473 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 493, + "end": 501 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n" + }, + "offset_header": 388, + "offset_body": 502, + "offset_end": 596 + } + ] } \ No newline at end of file diff --git a/tests/rfc/007.txt b/tests/rfc/007.txt index 642c7ac..c39e307 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -72,536 +72,556 @@ K --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "subject": { - "Text": "RFC 8621 Section 4.1.4 test" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "subject" - }, - { - "start": 8, - "end": 37 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 50, - "end": 81 - } - ] - ], "html_body": [ - 0, - 8, - 13 + 1, + 9, + 14 ], "text_body": [ - 0, - 4, + 1, 5, 6, - 13 + 7, + 14 ], "attachments": [ - 5, - 9, + 6, 10, 11, - 12 + 12, + 13 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null + "headers_rfc": { + "subject": { + "Text": "RFC 8621 Section 4.1.4 test" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "subject" }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } + { + "start": 8, + "end": 37 } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 99, - "end": 111 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 131, - "end": 139 - } - ] ], - "is_encoding_problem": false, - "body": "A", - "offset_header": 86, - "offset_body": 140, - "offset_end": 141 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 161, - "end": 192 - } - ] - ], - "offset_header": 148, - "offset_body": 193, - "offset_end": 801 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "3" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 210, - "end": 247 - } - ] - ], - "offset_header": 197, - "offset_body": 248, - "offset_end": 634 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "4" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 265, - "end": 296 - } - ] - ], - "offset_header": 252, - "offset_body": 297, - "offset_end": 487 - } - }, - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } + [ + { + "Rfc": "content_type" }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } + { + "start": 50, + "end": 81 } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 314, - "end": 326 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 346, - "end": 354 - } - ] - ], - "is_encoding_problem": false, - "body": "B", - "offset_header": 301, - "offset_body": 355, - "offset_end": 356 - } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 14 + ] + }, + "offset_header": 0, + "offset_body": 82, + "offset_end": 870 }, { - "InlineBinary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg", - "attributes": null - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 376, - "end": 388 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 408, - "end": 416 - } - ] + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 99, + "end": 111 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_disposition" + }, + { + "start": 131, + "end": 139 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "A" + }, + "offset_header": 86, + "offset_body": 140, + "offset_end": 142 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 161, + "end": 192 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 11, + 12, + 13 + ] + }, + "offset_header": 148, + "offset_body": 193, + "offset_end": 801 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "3" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 210, + "end": 247 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 4, + 8 + ] + }, + "offset_header": 197, + "offset_body": 248, + "offset_end": 634 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "4" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 265, + "end": 296 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 5, + 6, + 7 + ] + }, + "offset_header": 252, + "offset_body": 297, + "offset_end": 487 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 314, + "end": 326 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 346, + "end": 354 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "B" + }, + "offset_header": 301, + "offset_body": 355, + "offset_end": 357 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg", + "attributes": null + } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 376, + "end": 388 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 408, + "end": 416 + } + ] + ], + "is_encoding_problem": false, + "body": { + "InlineBinary": [ 67 - ], - "offset_header": 363, - "offset_body": 417, - "offset_end": 418 - } + ] + }, + "offset_header": 363, + "offset_body": 417, + "offset_end": 419 }, { - "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 + } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } + { + "start": 438, + "end": 450 } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 438, - "end": 450 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 470, - "end": 478 - } - ] ], - "is_encoding_problem": false, - "body": "D", - "offset_header": 425, - "offset_body": 479, - "offset_end": 480 - } + [ + { + "Rfc": "content_disposition" + }, + { + "start": 470, + "end": 478 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "D" + }, + "offset_header": 425, + "offset_body": 479, + "offset_end": 481 }, { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "5" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "5" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 506, - "end": 539 - } - ] - ], - "offset_header": 493, - "offset_body": 540, - "offset_end": 626 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 506, + "end": 539 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 9, + 10 + ] + }, + "offset_header": 493, + "offset_body": 540, + "offset_end": 626 }, { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": null } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 557, - "end": 568 - } - ] - ], - "is_encoding_problem": false, - "body": "E", - "offset_header": 544, - "offset_body": 569, - "offset_end": 583 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 557, + "end": 568 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "E" + }, + "offset_header": 544, + "offset_body": 569, + "offset_end": 584 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg", - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg", + "attributes": null } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 603, - "end": 615 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 603, + "end": 615 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 70 - ], - "offset_header": 590, - "offset_body": 616, - "offset_end": 617 - } + ] + }, + "offset_header": 590, + "offset_body": 616, + "offset_end": 618 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg", - "attributes": null - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg", + "attributes": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 655, - "end": 667 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 687, - "end": 699 - } - ] + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 655, + "end": 667 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Rfc": "content_disposition" + }, + { + "start": 687, + "end": 699 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 71 - ], - "offset_header": 642, - "offset_body": 700, - "offset_end": 701 - } + ] + }, + "offset_header": 642, + "offset_body": 700, + "offset_end": 702 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "x-excel", - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "x-excel", + "attributes": null } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 721, - "end": 742 - } - ] - ], - "is_encoding_problem": false, - "body": [ - 72 - ], - "offset_header": 708, - "offset_body": 743, - "offset_end": 744 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 764, - "end": 780 - } - ] - ], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "subject": { - "Text": "J" - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "headers_raw": [ - [ - { - "Rfc": "subject" - }, - { - "start": 789, - "end": 792 - } - ] - ], + { + "start": 721, + "end": 742 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ + 72 + ] + }, + "offset_header": 708, + "offset_body": 743, + "offset_end": 745 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 764, + "end": 780 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ 0 ], @@ -611,146 +631,70 @@ K "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "J", - "offset_header": 781, - "offset_body": 793, - "offset_end": 794 - } + "headers_rfc": { + "subject": { + "Text": "J" + } + }, + "is_encoding_problem": false, + "body": { + "Text": "J" + }, + "offset_header": 781, + "offset_body": 793, + "offset_end": 795 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 781, - "offset_body": 793, - "offset_end": 794 - }, - "offset_header": 751, - "offset_body": 781, - "offset_end": 794 - } + ] + } + }, + "offset_header": 751, + "offset_body": 781, + "offset_end": 795 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 821, - "end": 833 - } - ], - [ - { - "Rfc": "content_disposition" - }, - { - "start": 853, - "end": 861 - } - ] + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 821, + "end": 833 + } ], - "is_encoding_problem": false, - "body": "K", - "offset_header": 808, - "offset_body": 862, - "offset_end": 863 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "MultiPart": [ - 1, - [ - { - "MultiPart": [ - 2, - [ - { - "MultiPart": [ - 3, - [ - { - "Part": 4 - }, - { - "Part": 5 - }, - { - "Part": 6 - } - ] - ] - }, - { - "MultiPart": [ - 7, - [ - { - "Part": 8 - }, - { - "Part": 9 - } - ] - ] - } - ] - ] - }, - { - "Part": 10 - }, - { - "Part": 11 - }, - { - "Part": 12 - } - ] + [ + { + "Rfc": "content_disposition" + }, + { + "start": 853, + "end": 861 + } ] + ], + "is_encoding_problem": false, + "body": { + "Text": "K" }, - { - "Part": 13 - } - ] - }, - "offset_header": 0, - "offset_body": 82, - "offset_end": 869 + "offset_header": 808, + "offset_body": 862, + "offset_end": 864 + } + ] } \ No newline at end of file diff --git a/tests/rfc/008.txt b/tests/rfc/008.txt index f40891d..e406908 100644 --- a/tests/rfc/008.txt +++ b/tests/rfc/008.txt @@ -29,384 +29,268 @@ c2FnZQ0KICA8L2JvZHk+DQo8L2h0bWw+DQoNCi0tYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh YWFhYWFhYWFhYWFhYS0tDQo= --bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 13, - "end": 82 - } - ] - ], "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": "utf-8" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 139, - "end": 166 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 192, - "end": 198 - } - ] - ], - "is_encoding_problem": false, - "body": "This is a message with a base64 encoded attached email", - "offset_header": 126, - "offset_body": 199, - "offset_end": 253 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 82 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 83, + "offset_end": 1648 }, { - "Message": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "attached_email.eml" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_disposition" - }, - { - "start": 317, - "end": 360 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 373, - "end": 389 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 415, - "end": 423 - } - ] - ], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "from": { - "Address": { - "name": "Name", - "address": "email@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2021, - "month": 12, - "day": 14, - "hour": 11, - "minute": 48, - "second": 25, - "tz_before_gmt": false, - "tz_hour": 1, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "random-message-id@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - } - } - }, - "subject": { - "Text": "HTML test" - }, - "content_language": { - "Text": "en-US" - }, - "to": { - "Address": { - "name": "email@example.com", - "address": "email@example.com" - } - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "headers_raw": [ - [ - { - "Rfc": "to" - }, - { - "start": 3, - "end": 45 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 50, - "end": 77 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 85, - "end": 97 - } - ], - [ - { - "Rfc": "message_id" - }, - { - "start": 108, - "end": 142 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 147, - "end": 181 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 194, - "end": 200 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 213, - "end": 292 - } - ], - [ - { - "Rfc": "content_language" - }, - { - "start": 309, - "end": 317 - } - ] - ], + { + "start": 139, + "end": 166 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 192, + "end": 198 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "This is a message with a base64 encoded attached email" + }, + "offset_header": 126, + "offset_body": 199, + "offset_end": 254 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "attached_email.eml" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_disposition" + }, + { + "start": 317, + "end": 360 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 373, + "end": 389 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 415, + "end": 423 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ - 1 + 2 ], "text_body": [ - 0 + 1 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8", - "format": "flowed" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "email@example.com", + "address": "email@example.com" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 422, - "end": 465 + "subject": { + "Text": "HTML test" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 491, - "end": 498 - } - ] - ], - "is_encoding_problem": false, - "body": "This is an *HTML* test message", - "offset_header": 409, - "offset_body": 500, - "offset_end": 530 - } + } + }, + "content_language": { + "Text": "en-US" + }, + "from": { + "Address": { + "name": "Name", + "address": "email@example.com" + } + }, + "message_id": { + "Text": "random-message-id@example.com" + }, + "date": { + "DateTime": { + "year": 2021, + "month": 12, + "day": 14, + "hour": 11, + "minute": 48, + "second": 25, + "tz_before_gmt": false, + "tz_hour": 1, + "tz_minute": 0 + } + } + }, + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 319, + "offset_end": 872 }, { - "Html": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "utf-8" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8", + "format": "flowed" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 589, - "end": 616 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 642, - "end": 649 - } - ] - ], - "is_encoding_problem": false, - "body": "\r\n \r\n \r\n \r\n \r\n This is an HTML test message\r\n \r\n\r\n", - "offset_header": 576, - "offset_body": 651, - "offset_end": 824 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + "content_transfer_encoding": { + "Text": "7bit" + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 319, - "offset_end": 870 - }, - "offset_header": 297, - "offset_body": 424, - "offset_end": 1603 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + "is_encoding_problem": false, + "body": { + "Text": "This is an *HTML* test message" + }, + "offset_header": 409, + "offset_body": 500, + "offset_end": 532 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "utf-8" + } + } + } + }, + "is_encoding_problem": false, + "body": { + "Html": "\r\n \r\n \r\n \r\n \r\n This is an HTML test message\r\n \r\n\r\n" + }, + "offset_header": 576, + "offset_body": 651, + "offset_end": 826 + } + ] + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 83, - "offset_end": 1648 + "offset_header": 297, + "offset_body": 424, + "offset_end": 1604 + } + ] } \ No newline at end of file diff --git a/tests/thirdparty/000.txt b/tests/thirdparty/000.txt index ecc2d3b..8b70aed 100644 --- a/tests/thirdparty/000.txt +++ b/tests/thirdparty/000.txt @@ -19,144 +19,143 @@ ZWg= --bound-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "bound" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "mime_version" - }, - { - "start": 13, - "end": 19 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 32, - "end": 76 - } - ] - ], "html_body": [ - 0, - 1 + 1, + 2 ], "text_body": [ - 0, - 1 + 1, + 2 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 128, - "end": 137 + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "bound" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 150, - "end": 163 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "mime_version" + }, + { + "start": 13, + "end": 19 + } ], - "is_encoding_problem": false, - "body": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a", - "offset_header": 102, - "offset_body": 165, - "offset_end": 389 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 32, + "end": 76 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 78, + "offset_end": 480 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 413, - "end": 426 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 452, - "end": 461 - } - ] - ], - "is_encoding_problem": false, - "body": "eh", - "offset_header": 400, - "offset_body": 463, - "offset_end": 467 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 78, - "offset_end": 478 + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 128, + "end": 137 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 150, + "end": 163 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a" + }, + "offset_header": 102, + "offset_body": 165, + "offset_end": 391 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 413, + "end": 426 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 452, + "end": 461 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "eh" + }, + "offset_header": 400, + "offset_body": 463, + "offset_end": 469 + } + ] } \ No newline at end of file diff --git a/tests/thirdparty/001.txt b/tests/thirdparty/001.txt index b1f44f6..8440fc3 100644 --- a/tests/thirdparty/001.txt +++ b/tests/thirdparty/001.txt @@ -24,178 +24,175 @@ hello world --bound-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "bound" - } - } - }, - "mime_version": { - "Text": "1.0" - } - }, - "headers_raw": [ - [ - { - "Rfc": "mime_version" - }, - { - "start": 13, - "end": 19 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 32, - "end": 76 - } - ] - ], "html_body": [ - 0, 1, - 2 + 2, + 3 ], "text_body": [ - 0, 1, - 2 + 2, + 3 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, - "content_transfer_encoding": { - "Text": "binary" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 128, - "end": 137 + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "bound" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 150, - "end": 163 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "mime_version" + }, + { + "start": 13, + "end": 19 + } ], - "is_encoding_problem": false, - "body": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=", - "offset_header": 102, - "offset_body": 165, - "offset_end": 389 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 32, + "end": 76 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 78, + "offset_end": 531 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "binary" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 413, - "end": 426 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 452, - "end": 461 - } - ] + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 128, + "end": 137 + } ], - "is_encoding_problem": false, - "body": "ZWg=", - "offset_header": 400, - "offset_body": 463, - "offset_end": 467 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 150, + "end": 163 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=" + }, + "offset_header": 102, + "offset_body": 165, + "offset_end": 391 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 490, - "end": 503 - } - ] + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 413, + "end": 426 + } ], - "is_encoding_problem": false, - "body": "hello world\r\n", - "offset_header": 477, - "offset_body": 505, - "offset_end": 518 - } + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 452, + "end": 461 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "ZWg=" + }, + "offset_header": 400, + "offset_body": 463, + "offset_end": 468 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 490, + "end": 503 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "hello world\r\n" + }, + "offset_header": 477, + "offset_body": 505, + "offset_end": 520 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 78, - "offset_end": 529 + ] } \ No newline at end of file diff --git a/tests/thirdparty/002.txt b/tests/thirdparty/002.txt index bae68f8..cd89820 100644 --- a/tests/thirdparty/002.txt +++ b/tests/thirdparty/002.txt @@ -19,184 +19,181 @@ Content-Type: text/plain; charset=utf-8 --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": 44 - } - ] - ], "html_body": [ - 0, - 1 + 1, + 2 ], "text_body": [ - 0, - 1 + 1, + 2 ], "attachments": [ - 2 + 3 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "foo" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 77, - "end": 95 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 108, - "end": 135 - } - ] - ], - "is_encoding_problem": false, - "body": "päivää\n", - "offset_header": 51, - "offset_body": 136, - "offset_end": 158 - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 45, + "offset_end": 367 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 191, - "end": 199 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 212, - "end": 239 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 77, + "end": 95 + } ], - "is_encoding_problem": false, - "body": "yötä vaan.\n�\t�", - "offset_header": 165, - "offset_body": 240, - "offset_end": 268 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 108, + "end": 135 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "päivää\n" + }, + "offset_header": 51, + "offset_body": 136, + "offset_end": 159 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 301, - "end": 309 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 322, - "end": 349 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 191, + "end": 199 + } ], - "is_encoding_problem": true, - "body": "?garbage", - "offset_header": 275, - "offset_body": 350, - "offset_end": 358 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 212, + "end": 239 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "yötä vaan.\n�\t�" + }, + "offset_header": 165, + "offset_body": 240, + "offset_end": 269 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 301, + "end": 309 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 322, + "end": 349 + } + ] + ], + "is_encoding_problem": true, + "body": { + "Text": "?garbage" + }, + "offset_header": 275, + "offset_body": 350, + "offset_end": 359 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 45, - "offset_end": 366 + ] } \ No newline at end of file diff --git a/tests/thirdparty/003.txt b/tests/thirdparty/003.txt index fe76f7f..6cdcf94 100644 --- a/tests/thirdparty/003.txt +++ b/tests/thirdparty/003.txt @@ -34,292 +34,285 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "mime_version": { - "Text": "1.0" - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 13, - "end": 44 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 57, - "end": 62 - } - ] - ], "html_body": [ - 0, 1, 2, 3, - 4 + 4, + 5 ], "text_body": [ - 0, 1, 2, 3, - 4 + 4, + 5 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 93, - "end": 104 + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 117, - "end": 147 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } ], - "is_encoding_problem": false, - "body": "Move black king to queen's bishop\n", - "offset_header": 67, - "offset_body": 148, - "offset_end": 182 - } + [ + { + "Rfc": "mime_version" + }, + { + "start": 57, + "end": 62 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "offset_header": 0, + "offset_body": 63, + "offset_end": 656 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "binary" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 213, - "end": 224 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 237, - "end": 264 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 93, + "end": 104 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 187, - "offset_body": 265, - "offset_end": 287 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 117, + "end": 147 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move black king to queen's bishop\n" + }, + "offset_header": 67, + "offset_body": 148, + "offset_end": 183 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "8bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 318, - "end": 328 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 341, - "end": 368 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 213, + "end": 224 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 292, - "offset_body": 369, - "offset_end": 391 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 237, + "end": 264 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 187, + "offset_body": 265, + "offset_end": 288 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "8bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 422, - "end": 455 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 468, - "end": 495 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 318, + "end": 328 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 396, - "offset_body": 496, - "offset_end": 536 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 341, + "end": 368 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 292, + "offset_body": 369, + "offset_end": 392 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 567, - "end": 575 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 588, - "end": 615 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 422, + "end": 455 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 541, - "offset_body": 616, - "offset_end": 649 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 468, + "end": 495 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 396, + "offset_body": 496, + "offset_end": 537 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 567, + "end": 575 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 588, + "end": 615 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 541, + "offset_body": 616, + "offset_end": 650 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - }, - { - "Part": 4 - } - ] - }, - "offset_header": 0, - "offset_body": 63, - "offset_end": 655 + ] } \ No newline at end of file diff --git a/tests/thirdparty/004.txt b/tests/thirdparty/004.txt index cca0e5a..bc49c3e 100644 --- a/tests/thirdparty/004.txt +++ b/tests/thirdparty/004.txt @@ -40,337 +40,328 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "mime_version": { - "Text": "1.0" - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 13, - "end": 44 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 57, - "end": 62 - } - ] - ], "html_body": [ - 0, 1, 2, 3, 4, - 5 + 5, + 6 ], "text_body": [ - 0, 1, 2, 3, 4, - 5 + 5, + 6 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "6bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 93, - "end": 99 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 112, - "end": 139 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } ], - "is_encoding_problem": false, - "body": "Move black king to queen's bishop\n", - "offset_header": 67, - "offset_body": 140, - "offset_end": 174 - } + [ + { + "Rfc": "mime_version" + }, + { + "start": 57, + "end": 62 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3, + 4, + 5, + 6 + ] + }, + "offset_header": 0, + "offset_body": 63, + "offset_end": 704 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "7bits" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "6bit" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 205, - "end": 218 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 231, - "end": 258 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 93, + "end": 99 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 179, - "offset_body": 259, - "offset_end": 281 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 112, + "end": 139 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move black king to queen's bishop\n" + }, + "offset_header": 67, + "offset_body": 140, + "offset_end": 175 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "8 bit" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bits" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 312, - "end": 319 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 332, - "end": 359 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 205, + "end": 218 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 286, - "offset_body": 360, - "offset_end": 382 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 231, + "end": 258 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 179, + "offset_body": 259, + "offset_end": 282 }, { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "7-bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "8 bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 413, - "end": 420 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 433, - "end": 460 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 312, + "end": 319 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 387, - "offset_body": 461, - "offset_end": 483 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 332, + "end": 359 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 286, + "offset_body": 360, + "offset_end": 383 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "8-bit" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "7-bit" }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 514, - "end": 521 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 534, - "end": 561 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 413, + "end": 420 + } ], - "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n", - "offset_header": 488, - "offset_body": 562, - "offset_end": 584 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 433, + "end": 460 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 387, + "offset_body": 461, + "offset_end": 484 }, { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "8-bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 615, - "end": 616 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 629, - "end": 656 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 514, + "end": 521 + } ], - "is_encoding_problem": false, - "body": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n", - "offset_header": 589, - "offset_body": 657, - "offset_end": 697 - } + [ + { + "Rfc": "content_type" + }, + { + "start": 534, + "end": 561 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move ♚ to ♛'s ♝\n" + }, + "offset_header": 488, + "offset_body": 562, + "offset_end": 585 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 615, + "end": 616 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 629, + "end": 656 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n" + }, + "offset_header": 589, + "offset_body": 657, + "offset_end": 698 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - }, - { - "Part": 3 - }, - { - "Part": 4 - }, - { - "Part": 5 - } - ] - }, - "offset_header": 0, - "offset_body": 63, - "offset_end": 703 + ] } \ No newline at end of file diff --git a/tests/thirdparty/005.txt b/tests/thirdparty/005.txt index 4f37419a074a345da84e79d78764e343225da13d..0d04bda34f4efa712719a6ff588690409bd7e74d 100644 GIT binary patch literal 5981 zcmeHL&2HO95Z0MbLF~C~M2e&=2R_h>;-sk1$d!UNsUc9(N@5|B0!i6%3j=DSwf~B8i z_rl->o!r+)@hY15$>|<3iPnAG?HEsKk_K_KtDB$KHO(+gt&JiQKT4-GF*?yWo&?cs zS04otELJmeB^iB@-CHjFAiA%Q=YEpXY;ToK4bxpvP3zZaEv;oWy%y%JwC2}l(9&vG zD)Uq7+FL6dfimx5&wJL}|G|6I^B#NqnRhVo#wYOqpyNF|*X-}d$+hM_(4u2FAi&^Eq!qG|EudvE#WSK;xFWyk4*WYulYt=`@i znzjw&p#RX=(X=2s_7}kflEW~V`wTd&D=*UiuJm&IQV{<5L(h&2hzp!ZtfXPG~qhmh#0)Zs{REa6o@gTx*(r~U+z zeV9zgun4f>l$0kx~>4G0SSBl309v#=L=hB5lv_Pd$ zm3J~j#6}~X1IlqV11m|$w;z?r5FCsWdLOu~%BCy!hcnyx?Y;44@i=%`g?653WU4wq)ShBpBdvH|u6mkZd0*kx6GEzDAmD`1=Ig+L<#ejqV%Z|KuB(?go3{)~PXVR)rSktLE?t}G)sB$#E|4*Cp7 zgo~TJ#0Z%fAC(mUom%;!2eFs(;m%NNL=}FPpGcx|8+%oJtNE66CTRStZKkvRa?Wg%yS88KmF;Y2RvC z>&ew<@B<4sx{$+|K{rjVhP|F#jpoNmE~~YPT#e=ia@po5a$QC)ewV+q`<895r~*-#@>6_vX!CuYddV_h0{ceg5|RCycZ@eN?Yq zwz-L9c1t?Dyn{LBP7ePDkB9jeBLsifj)(bYECrq=gsS$%HukFMd<17h$KFvJ62mT1 z*>T+UM=&+}X762&+fu5Ez*-xCZOO4LSzY!$1g~AiuaetbyBu{4K>CQIq0_o>BNLxA N>P=28_&w6j{slGjeJB6` literal 6259 zcmeHL&2HO95Z0MbLGWBAB1KA;10QHbaZ*Hx*YIn~DuMfely(k=&n|*_rQ~o!w3nQxa2qaJnYD<|<#(XdR~X z;VODVrjN{VlE>39J>9b$%jiApb?uiV&7vgUHJt}_!?10~=%9!+jI$X@?QT3trcpfK zHOEm5lZz2t2_l~WeXxH1Vs*UZdP(*;&3m1N+uyr_ zrmKc=ICx_37)BHyhs$UR;IM7xKHE0CUmtcmgYIMVtHIH*GZ-FqP1gRSVVc&0gi}D( zD4k8LU6VCI<3ylpL;*9Z71|}*7+$qzHUWoP3dPnJT$YeG%JQ)kW^r`uy& zNIIO5r&^JflEjkmoe86J(Hh3QeAe^Z4_%7*MUUv?iR2QZG^Ix3E*G zY`Qp4sDyv6)>_cjax_k+r)ueSG1(ChS3DYO0?QrOngD?fCyN!NI2Kv4O6CBepQXB@ z9T$V)!f#l|We{bKhAstEnf^vZra#bENZ>;e1|lsMV3Jti@=78%LC&RAF+fb$c)*;c zfn4=#MBr)o;+RT0pbU|=VTBfEZhbXu6cR+t(7%dz&HyP=d069t=n_E_?>Z;s#7$;g z2m{9)PS;ejrgDHFnn;|sMjWX~(8sAeWr5lk2Ni0%rr9jiny3v(Y_ZgFyn=9LQx(-k zbK!WvztW`{ZAF3mdvXa>hcJ+~n zDM)DQIYD+xDURoBqGg|SbqifBESIsvn0C^E7qqa*IIL zsXfPa>I&klvjqMEai-i8a6WtQ~PPdts-ipam$F>@T!Q~Xx$c~y6tMBHd>WL z^_+X6-V{;AsamfN7~u8XUH&S1v>l^3Slo`X*Ym1q>iM^fre3p(rk>i4SVYQEczpx= z>HG7aKm7IEzrX(U;oZA`-v06TpTGb2_Wb?%FWV|$M?*Vdd~-dTO8B@GtvkKhqnXBWZ=@FxU$1EtB7`Sh}y)_p%;g!8@K8qSj%itv~g7k>*9ma XHR^oNZ|$&EI!vTzY?PjYL)qE?mvNyw diff --git a/tests/thirdparty/006.txt b/tests/thirdparty/006.txt index a98b9f4..ca2823a 100644 --- a/tests/thirdparty/006.txt +++ b/tests/thirdparty/006.txt @@ -29,229 +29,250 @@ Signed by undersigned --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "subject": { - "Text": "Hide and seek" - }, - "mime_version": { - "Text": "1.0" - } - }, - "headers_raw": [ - [ - { - "Rfc": "subject" - }, - { - "start": 8, - "end": 23 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 36, - "end": 41 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 54, - "end": 83 - } - ] - ], "html_body": [ - 2 - ], - "text_body": [ 3 ], - "attachments": [ + "text_body": [ 4 ], + "attachments": [ + 5 + ], "parts": [ { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "signed", - "attributes": { - "migalc": "pen+paper", - "boundary": "2", - "protocol": "signature/plain" - } + "headers_rfc": { + "subject": { + "Text": "Hide and seek" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 101, - "end": 179 - } - ], - [ - { - "Other": "X-Signature-Type" - }, - { - "start": 196, - "end": 208 - } - ] - ], - "offset_header": 88, - "offset_body": 209, - "offset_end": 579 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "3" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 226, - "end": 261 - } - ] - ], - "offset_header": 213, - "offset_body": 262, - "offset_end": 497 - } - }, - { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 279, - "end": 308 - } - ] - ], - "is_encoding_problem": false, - "body": "Search me

Don't find me here

\n", - "offset_header": 266, - "offset_body": 309, - "offset_end": 398 - } - }, - { - "Text": { - "headers_rfc": { - "content_transfer_encoding": { - "Text": "binary" + } + }, + "headers_raw": [ + [ + { + "Rfc": "subject" }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } + { + "start": 8, + "end": 23 } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 416, - "end": 428 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 454, - "end": 462 - } - ] ], - "is_encoding_problem": false, - "body": "Search me, and Find me here", - "offset_header": 403, - "offset_body": 463, - "offset_end": 490 - } + [ + { + "Rfc": "mime_version" + }, + { + "start": 36, + "end": 41 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 54, + "end": 83 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1 + ] + }, + "offset_header": 0, + "offset_body": 84, + "offset_end": 585 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "signature", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "signed", + "attributes": { + "migalc": "pen+paper", + "boundary": "2", + "protocol": "signature/plain" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 515, - "end": 550 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 101, + "end": 179 + } ], - "is_encoding_problem": false, - "body": [ + [ + { + "Other": "X-Signature-Type" + }, + { + "start": 196, + "end": 208 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 2, + 5 + ] + }, + "offset_header": 88, + "offset_body": 209, + "offset_end": 579 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "3" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 226, + "end": 261 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 4 + ] + }, + "offset_header": 213, + "offset_body": 262, + "offset_end": 497 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 279, + "end": 308 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Html": "Search me

Don't find me here

\n" + }, + "offset_header": 266, + "offset_body": 309, + "offset_end": 399 + }, + { + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 416, + "end": 428 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 454, + "end": 462 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Search me, and Find me here" + }, + "offset_header": 403, + "offset_body": 463, + "offset_end": 491 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "signature", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 515, + "end": 550 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 83, 105, 103, @@ -273,37 +294,11 @@ Signed by undersigned 110, 101, 100 - ], - "offset_header": 502, - "offset_body": 551, - "offset_end": 572 - } + ] + }, + "offset_header": 502, + "offset_body": 551, + "offset_end": 573 } - ], - "structure": { - "MultiPart": [ - 0, - [ - { - "MultiPart": [ - 1, - [ - { - "Part": 2 - }, - { - "Part": 3 - } - ] - ] - }, - { - "Part": 4 - } - ] - ] - }, - "offset_header": 0, - "offset_body": 84, - "offset_end": 585 + ] } \ No newline at end of file diff --git a/tests/thirdparty/007.txt b/tests/thirdparty/007.txt index 6a6702e..3ad7572 100644 --- a/tests/thirdparty/007.txt +++ b/tests/thirdparty/007.txt @@ -33,96 +33,78 @@ Foobar --2-- --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "digest", - "attributes": { - "boundary": "1" - } - } - }, - "from": { - "Address": { - "name": "Moderator-Address", - "address": "moderator" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 5, - "end": 36 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 49, - "end": 80 - } - ] - ], "html_body": [], "text_body": [], "attachments": [ - 0, 1, - 2 + 2, + 3 ], "parts": [ { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } + "headers_rfc": { + "from": { + "Address": { + "name": "Moderator-Address", + "address": "moderator" } }, - "headers_raw": [], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "subject": { - "Text": "my opinion" - }, - "from": { - "Address": { - "name": "someone-else", - "address": "someone@else" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "digest", + "attributes": { + "boundary": "1" } + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "from" }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 92, - "end": 121 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 129, - "end": 141 - } - ] - ], + { + "start": 5, + "end": 36 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 49, + "end": 80 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 81, + "offset_end": 570 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ 0 ], @@ -132,322 +114,195 @@ Foobar "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } + "headers_rfc": { + "subject": { + "Text": "my opinion" }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "This is my opinion", - "offset_header": 87, - "offset_body": 142, - "offset_end": 160 - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 87, - "offset_body": 142, - "offset_end": 160 - }, - "offset_header": 86, - "offset_body": 87, - "offset_end": 160 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "subject": { - "Text": "i disagree" - }, - "from": { - "Address": { - "name": "another one", - "address": "another@one" - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 171, - "end": 198 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 206, - "end": 218 - } - ] - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "attachments": [], - "parts": [ - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } + "from": { + "Address": { + "name": "someone-else", + "address": "someone@else" } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "Not agreeing one bit!", - "offset_header": 166, - "offset_body": 219, - "offset_end": 240 - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 166, - "offset_body": 219, - "offset_end": 240 - }, - "offset_header": 165, - "offset_body": 166, - "offset_end": 240 - } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "subject": { - "Text": "funny hat" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" } - } - }, - "from": { - "Address": { - "name": "attachment", - "address": "attachment@user" - } + }, + "is_encoding_problem": false, + "body": { + "Text": "This is my opinion" + }, + "offset_header": 87, + "offset_body": 142, + "offset_end": 161 } - }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 251, - "end": 281 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 289, - "end": 300 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 313, - "end": 342 - } - ] - ], + ] + } + }, + "offset_header": 86, + "offset_body": 87, + "offset_end": 161 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ 0 ], "text_body": [ 0 ], - "attachments": [ + "attachments": [], + "parts": [ + { + "headers_rfc": { + "from": { + "Address": { + "name": "another one", + "address": "another@one" + } + }, + "subject": { + "Text": "i disagree" + } + }, + "is_encoding_problem": false, + "body": { + "Text": "Not agreeing one bit!" + }, + "offset_header": 166, + "offset_body": 219, + "offset_end": 241 + } + ] + } + }, + "offset_header": 165, + "offset_body": 166, + "offset_end": 241 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [], + "is_encoding_problem": false, + "body": { + "Message": { + "html_body": [ 1 ], + "text_body": [ + 1 + ], + "attachments": [ + 2 + ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null + "headers_rfc": { + "subject": { + "Text": "funny hat" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } - }, - "content_transfer_encoding": { - "Text": "binary" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 360, - "end": 372 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 398, - "end": 406 - } - ] - ], - "is_encoding_problem": false, - "body": "Lovely attachment for you", - "offset_header": 347, - "offset_body": 407, - "offset_end": 432 - } + "from": { + "Address": { + "name": "attachment", + "address": "attachment@user" + } + } + }, + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 246, + "offset_body": 343, + "offset_end": 565 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "disposition": "attachment", - "name": "test.txt" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "Lovely attachment for you" + }, + "offset_header": 347, + "offset_body": 407, + "offset_end": 433 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "disposition": "attachment", + "name": "test.txt" } - }, - "content_transfer_encoding": { - "Text": "binary" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 450, - "end": 517 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 543, - "end": 551 - } - ] - ], - "is_encoding_problem": false, - "body": [ + "content_transfer_encoding": { + "Text": "binary" + } + }, + "is_encoding_problem": false, + "body": { + "Binary": [ 70, 111, 111, 98, 97, 114 - ], - "offset_header": 437, - "offset_body": 552, - "offset_end": 558 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + ] }, - { - "Part": 1 - } - ] - }, - "offset_header": 246, - "offset_body": 343, - "offset_end": 564 - }, - "offset_header": 245, - "offset_body": 246, - "offset_end": 564 - } + "offset_header": 437, + "offset_body": 552, + "offset_end": 559 + } + ] + } + }, + "offset_header": 245, + "offset_body": 246, + "offset_end": 565 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 81, - "offset_end": 570 + ] } \ No newline at end of file diff --git a/tests/thirdparty/008.txt b/tests/thirdparty/008.txt index f338121..b031d62 100644 --- a/tests/thirdparty/008.txt +++ b/tests/thirdparty/008.txt @@ -56,462 +56,374 @@ Root MIME epilogue ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "foo bar" - } - } - }, - "date": { - "DateTime": { - "year": 2007, - "month": 3, - "day": 24, - "hour": 23, - "minute": 0, - "second": 0, - "tz_before_gmt": false, - "tz_hour": 2, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": null, - "address": "user@domain.org" - } - } - }, - "headers_raw": [ - [ - { - "Other": "From user@domain Fri Feb 22 17" - }, - { - "start": 32, - "end": 43 - } - ], - [ - { - "Rfc": "from" - }, - { - "start": 48, - "end": 65 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 70, - "end": 103 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 116, - "end": 121 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 134, - "end": 171 - } - ] - ], "html_body": [ - 2 + 3 ], "text_body": [ - 2 + 3 ], "attachments": [ - 0, - 1 + 1, + 2 ], "parts": [ { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "x-myown", - "attributes": { - "charset": "us-ascii" - } - } + "headers_rfc": { + "from": { + "Address": { + "name": null, + "address": "user@domain.org" } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 215, - "end": 247 + "date": { + "DateTime": { + "year": 2007, + "month": 3, + "day": 24, + "hour": 23, + "minute": 0, + "second": 0, + "tz_before_gmt": false, + "tz_hour": 2, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "foo bar" } - ] + } + } + }, + "headers_raw": [ + [ + { + "Other": "From user@domain Fri Feb 22 17" + }, + { + "start": 32, + "end": 43 + } ], - "is_encoding_problem": false, - "body": "hello\n", - "offset_header": 202, - "offset_body": 248, - "offset_end": 254 - } + [ + { + "Rfc": "from" + }, + { + "start": 48, + "end": 65 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 70, + "end": 103 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 116, + "end": 121 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 134, + "end": 171 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2, + 3 + ] + }, + "offset_header": 0, + "offset_body": 172, + "offset_end": 790 }, { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "x-myown", + "attributes": { + "charset": "us-ascii" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 278, - "end": 294 - } - ] - ], - "is_encoding_problem": false, - "body": { - "headers_rfc": { - "date": { - "DateTime": { - "year": 2012, - "month": 8, - "day": 12, - "hour": 12, - "minute": 34, - "second": 56, - "tz_before_gmt": false, - "tz_hour": 3, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": null, - "address": "sub@domain.org" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub1" - } - } - }, - "subject": { - "Text": "submsg" - } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" }, - "headers_raw": [ - [ - { - "Rfc": "from" - }, - { - "start": 300, - "end": 316 - } - ], - [ - { - "Rfc": "date" - }, - { - "start": 321, - "end": 354 - } - ], - [ - { - "Rfc": "subject" - }, - { - "start": 362, - "end": 370 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 383, - "end": 423 - } - ] - ], + { + "start": 215, + "end": 247 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "hello\n" + }, + "offset_header": 202, + "offset_body": 248, + "offset_end": 255 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 278, + "end": 294 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Message": { "html_body": [ - 0, - 4 + 1, + 5 ], "text_body": [ - 3, 4, - 5 + 5, + 6 ], "attachments": [], "parts": [ { - "Html": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": null + "headers_rfc": { + "from": { + "Address": { + "name": null, + "address": "sub@domain.org" + } + }, + "subject": { + "Text": "submsg" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub1" } } }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 462, - "end": 473 - } - ] - ], - "is_encoding_problem": false, - "body": "

Hello world

\n", - "offset_header": 449, - "offset_body": 474, - "offset_end": 493 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub2" - } - } + "date": { + "DateTime": { + "year": 2012, + "month": 8, + "day": 12, + "hour": 12, + "minute": 34, + "second": 56, + "tz_before_gmt": false, + "tz_hour": 3, + "tz_minute": 0 } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 514, - "end": 554 - } - ] - ], - "offset_header": 501, - "offset_body": 555, - "offset_end": 701 - } - }, - { - "Multipart": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub3" - } - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 575, - "end": 615 - } - ] - ], - "offset_header": 562, - "offset_body": 616, - "offset_end": 662 - } - }, - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "sub3 text", - "offset_header": 623, - "offset_body": 624, - "offset_end": 633 - } - }, - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "sub3 text2", - "offset_header": 641, - "offset_body": 642, - "offset_end": 652 - } - }, - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [], - "is_encoding_problem": false, - "body": "sub2 text2", - "offset_header": 680, - "offset_body": 681, - "offset_end": 691 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + } }, - { - "MultiPart": [ + "is_encoding_problem": false, + "body": { + "Multipart": [ 1, - [ - { - "MultiPart": [ - 2, - [ - { - "Part": 3 - }, - { - "Part": 4 - } - ] - ] - }, - { - "Part": 5 - } - ] + 2 ] - } - ] - }, - "offset_header": 295, - "offset_body": 424, - "offset_end": 728 - }, - "offset_header": 265, - "offset_body": 295, - "offset_end": 728 - } - }, - { - "Text": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" + }, + "offset_header": 295, + "offset_body": 424, + "offset_end": 710 }, { - "start": 752, - "end": 764 + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Html": "

Hello world

\n" + }, + "offset_header": 449, + "offset_body": 474, + "offset_end": 494 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub2" + } + } + } + }, + "is_encoding_problem": false, + "body": { + "Multipart": [ + 3, + 6 + ] + }, + "offset_header": 501, + "offset_body": 555, + "offset_end": 701 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub3" + } + } + } + }, + "is_encoding_problem": false, + "body": { + "Multipart": [ + 4, + 5 + ] + }, + "offset_header": 562, + "offset_body": 616, + "offset_end": 662 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "sub3 text" + }, + "offset_header": 623, + "offset_body": 624, + "offset_end": 634 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "sub3 text2" + }, + "offset_header": 641, + "offset_body": 642, + "offset_end": 653 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "is_encoding_problem": false, + "body": { + "Text": "sub2 text2" + }, + "offset_header": 680, + "offset_body": 681, + "offset_end": 692 } ] - ], - "is_encoding_problem": false, - "body": "Another part", - "offset_header": 739, - "offset_body": 765, - "offset_end": 777 - } + } + }, + "offset_header": 265, + "offset_body": 295, + "offset_end": 729 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 752, + "end": 764 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Another part" + }, + "offset_header": 739, + "offset_body": 765, + "offset_end": 778 } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - }, - { - "Part": 2 - } - ] - }, - "offset_header": 0, - "offset_body": 172, - "offset_end": 789 + ] } \ No newline at end of file diff --git a/tests/thirdparty/009.txt b/tests/thirdparty/009.txt index 3a78dda..782e7f0 100644 --- a/tests/thirdparty/009.txt +++ b/tests/thirdparty/009.txt @@ -20,131 +20,143 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "subject": { - "Text": "In parts" - } - }, - "headers_raw": [ - [ - { - "Rfc": "subject" - }, - { - "start": 8, - "end": 18 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 31, - "end": 36 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 49, - "end": 78 - } - ] - ], "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": "binary" - } + "headers_rfc": { + "subject": { + "Text": "In parts" }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 96, - "end": 108 + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 134, - "end": 142 - } - ] + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "subject" + }, + { + "start": 8, + "end": 18 + } ], - "is_encoding_problem": false, - "body": "Hi, this is the fancy thing I was talking about!", - "offset_header": 83, - "offset_body": 143, - "offset_end": 191 - } + [ + { + "Rfc": "mime_version" + }, + { + "start": 31, + "end": 36 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 49, + "end": 78 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1, + 2 + ] + }, + "offset_header": 0, + "offset_body": 79, + "offset_end": 522 }, { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "partial", - "attributes": { - "id": "heks68ewe@example.org", - "total": "5", - "number": "1" - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 96, + "end": 108 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 134, + "end": 142 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "Hi, this is the fancy thing I was talking about!" + }, + "offset_header": 83, + "offset_body": 143, + "offset_end": 192 + }, + { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "partial", + "attributes": { + "number": "1", + "total": "5", + "id": "heks68ewe@example.org" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 209, - "end": 273 - } - ] - ], - "is_encoding_problem": false, - "body": [ + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 209, + "end": 273 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Binary": [ 88, 45, 87, @@ -386,24 +398,11 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= 81, 111, 61 - ], - "offset_header": 196, - "offset_body": 274, - "offset_end": 515 - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + ] }, - { - "Part": 1 - } - ] - }, - "offset_header": 0, - "offset_body": 79, - "offset_end": 521 + "offset_header": 196, + "offset_body": 274, + "offset_end": 516 + } + ] } \ No newline at end of file diff --git a/tests/thirdparty/010.txt b/tests/thirdparty/010.txt index e6ae8ad..f6aff4a 100644 --- a/tests/thirdparty/010.txt +++ b/tests/thirdparty/010.txt @@ -11,119 +11,124 @@ Content-Language: ja 人権の無視及 --1-- ---- EXPECTED STRUCTURE ----{ - "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "comment": "人権の無視及", - "boundary": "1" - } - } - }, - "subject": { - "Text": "こんにちは" - } - }, - "headers_raw": [ - [ - { - "Rfc": "subject" - }, - { - "start": 8, - "end": 42 - } - ], - [ - { - "Rfc": "mime_version" - }, - { - "start": 55, - "end": 60 - } - ], - [ - { - "Rfc": "content_type" - }, - { - "start": 73, - "end": 145 - } - ] - ], "html_body": [ - 0 + 1 ], "text_body": [ - 0 + 1 ], "attachments": [], "parts": [ { - "Text": { - "headers_rfc": { - "content_language": { - "Text": "ja" - }, - "content_transfer_encoding": { - "Text": "binary" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null + "headers_rfc": { + "subject": { + "Text": "こんにちは" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1", + "comment": "人権の無視及" } } - }, - "headers_raw": [ - [ - { - "Rfc": "content_type" - }, - { - "start": 163, - "end": 175 - } - ], - [ - { - "Rfc": "content_transfer_encoding" - }, - { - "start": 201, - "end": 209 - } - ], - [ - { - "Rfc": "content_language" - }, - { - "start": 226, - "end": 230 - } - ] + } + }, + "headers_raw": [ + [ + { + "Rfc": "subject" + }, + { + "start": 8, + "end": 42 + } ], - "is_encoding_problem": false, - "body": "人権の無視及", - "offset_header": 150, - "offset_body": 231, - "offset_end": 249 - } + [ + { + "Rfc": "mime_version" + }, + { + "start": 55, + "end": 60 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 73, + "end": 145 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Multipart": [ + 1 + ] + }, + "offset_header": 0, + "offset_body": 146, + "offset_end": 255 + }, + { + "headers_rfc": { + "content_language": { + "Text": "ja" + }, + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 163, + "end": 175 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 201, + "end": 209 + } + ], + [ + { + "Rfc": "content_language" + }, + { + "start": 226, + "end": 230 + } + ] + ], + "is_encoding_problem": false, + "body": { + "Text": "人権の無視及" + }, + "offset_header": 150, + "offset_body": 231, + "offset_end": 250 } - ], - "structure": { - "Part": 0 - }, - "offset_header": 0, - "offset_body": 146, - "offset_end": 255 + ] } \ No newline at end of file