From 5d4c0538ca841abfa744bff4d62f3192e9d25624 Mon Sep 17 00:00:00 2001 From: Mauro D Date: Tue, 12 Jul 2022 15:18:22 +0000 Subject: [PATCH] Raw body parts offset support. --- src/parsers/message.rs | 75 ++++--- tests/legacy/000.txt | 174 +++++++++++++++- tests/legacy/001.txt | 168 ++++++++++++++-- tests/legacy/002.txt | 160 +++++++++++++-- tests/legacy/003.txt | 208 +++++++++++++++---- tests/legacy/004.txt | 134 +++++++++++-- tests/legacy/005.txt | 162 ++++++++++++++- tests/legacy/006.txt | 244 +++++++++++++++++++---- tests/legacy/007.txt | 174 ++++++++++++++-- tests/legacy/008.txt | 299 ++++++++++++++++++++++++---- tests/legacy/009.txt | 151 +++++++++++++- tests/legacy/010.txt | 158 +++++++++++++-- tests/legacy/011.txt | 129 +++++++++++- tests/legacy/012.txt | 168 ++++++++++++++-- tests/legacy/013.txt | 180 +++++++++++++++-- tests/legacy/014.txt | 182 +++++++++++++++-- tests/legacy/015.txt | 420 ++++++++++++++++++++++++++++++++++----- tests/legacy/016.txt | 238 ++++++++++++++++++---- tests/legacy/017.txt | 221 +++++++++++++++++--- tests/legacy/018.txt | 312 +++++++++++++++++++++++++---- tests/legacy/019.txt | 324 +++++++++++++++++++++++++----- tests/legacy/020.txt | 172 ++++++++++++++-- tests/legacy/021.txt | 386 ++++++++++++++++++++++++++++++----- tests/legacy/022.txt | 174 ++++++++++++++-- tests/legacy/023.txt | 293 ++++++++++++++++++++++----- tests/legacy/024.txt | 249 ++++++++++++++++++++--- tests/legacy/025.txt | 349 ++++++++++++++++++++++++++++---- tests/legacy/026.txt | 239 ++++++++++++++++++---- tests/legacy/027.txt | 178 +++++++++++++++-- tests/legacy/028.txt | 312 +++++++++++++++++++++++++---- tests/legacy/029.txt | 164 +++++++++++++-- tests/legacy/030.txt | 298 ++++++++++++++++++++++----- tests/legacy/031.txt | 267 +++++++++++++++++++++---- tests/legacy/032.txt | 313 ++++++++++++++++++++++++----- tests/legacy/033.txt | 148 ++++++++++++-- tests/legacy/034.txt | 153 ++++++++++++-- tests/legacy/035.txt | 417 ++++++++++++++++++++++++++++++++------ tests/legacy/036.txt | 121 +++++++++-- tests/legacy/037.txt | 174 ++++++++++++++-- tests/legacy/038.txt | 143 +++++++++++-- tests/legacy/039.txt | 334 +++++++++++++++++++++++++++---- tests/legacy/040.txt | 159 +++++++++++++-- tests/legacy/041.txt | 195 +++++++++++++++--- tests/legacy/042.txt | 170 ++++++++++++++-- tests/legacy/043.txt | 161 +++++++++++++-- tests/legacy/044.txt | 274 +++++++++++++++++++++---- tests/legacy/045.txt | 225 ++++++++++++++++----- tests/legacy/046.txt | 147 ++++++++++++-- tests/legacy/047.txt | 180 +++++++++++++++-- tests/legacy/048.txt | 246 +++++++++++++++++++++-- tests/legacy/049.txt | 106 +++++++++- tests/legacy/050.txt | 265 ++++++++++++++++++++---- tests/legacy/051.txt | 403 +++++++++++++++++++++++++++++++------ tests/legacy/052.txt | 122 ++++++++++-- tests/legacy/053.txt | 170 ++++++++++++++-- tests/malformed/000.txt | 11 + tests/malformed/001.txt | 33 ++- tests/malformed/002.txt | 27 ++- tests/malformed/003.txt | 43 +++- tests/malformed/004.txt | 17 +- tests/malformed/005.txt | 43 +++- tests/malformed/006.txt | 43 +++- tests/malformed/007.txt | 48 ++++- tests/malformed/008.txt | 43 +++- tests/malformed/009.txt | 59 +++++- tests/malformed/010.txt | 61 +++++- tests/malformed/011.txt | 59 +++++- tests/malformed/012.txt | 117 ++++++++++- tests/malformed/013.txt | 242 ++++++++++++++++++---- tests/malformed/014.txt | 27 ++- tests/malformed/015.txt | 167 +++++++++++++--- tests/malformed/016.txt | 92 ++++++++- tests/rfc/000.txt | 280 +++++++++++++++++++++++--- tests/rfc/001.txt | 360 +++++++++++++++++++++------------ tests/rfc/002.txt | 354 +++++++++++++++++++++++++++------ tests/rfc/003.txt | 36 ++-- tests/rfc/004.txt | 212 +++++++++++++++++--- tests/rfc/005.txt | 38 ++-- tests/rfc/006.txt | 152 +++++++++++--- tests/rfc/007.txt | 42 ++-- tests/rfc/008.txt | 238 +++++++++++++++++++--- tests/thirdparty/000.txt | 76 ++++++- tests/thirdparty/001.txt | 92 ++++++++- tests/thirdparty/002.txt | 86 +++++++- tests/thirdparty/003.txt | 169 ++++++++++++++-- tests/thirdparty/004.txt | 200 +++++++++++++++++-- tests/thirdparty/005.txt | Bin 3633 -> 6259 bytes tests/thirdparty/006.txt | 139 ++++++++++++- tests/thirdparty/007.txt | 211 +++++++++++++++++--- tests/thirdparty/008.txt | 233 +++++++++++++++++++--- tests/thirdparty/009.txt | 80 +++++++- tests/thirdparty/010.txt | 69 ++++++- 92 files changed, 14125 insertions(+), 2062 deletions(-) diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 54d8729..0eb31bf 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -145,7 +145,7 @@ fn add_missing_type<'x>( } } -#[derive(Default)] +#[derive(Default, Debug)] struct MessageParserState { mime_type: MimeType, mime_boundary: Option>, @@ -663,28 +663,46 @@ impl<'x> Message<'x> { } } - while let (Some((mut prev_message, headers, headers_raw)), Some(prev_state)) = - (message_stack.pop(), state_stack.pop()) - { - if !message.is_empty() { - message.offset_header = state.offset_header; - message.offset_body = state.offset_body; - message.offset_end = stream.pos; - message.structure = state.get_structure(); - message.raw_message = raw_message[message.offset_header..message.offset_end].into(); - prev_message.attachments.push(prev_message.parts.len()); - prev_message.parts.push(MessagePart::Message(Part { - headers_rfc: headers, - headers_raw, - is_encoding_problem: false, - offset_header: prev_state.offset_header, - offset_body: prev_state.offset_body, - offset_end: message.offset_end, - body: MessageAttachment::Parsed(Box::new(message)), - })); + // Corrupted MIME message, try to recover whatever is possible. + loop { + if let Some((mut prev_message, headers, headers_raw)) = message_stack.pop() { + let prev_state = state_stack.pop().unwrap(); + if !message.is_empty() { + message.offset_header = state.offset_header; + message.offset_body = state.offset_body; + message.offset_end = stream.pos; + message.structure = state.get_structure(); + message.raw_message = + raw_message[message.offset_header..message.offset_end].into(); + prev_message.attachments.push(prev_message.parts.len()); + prev_message.parts.push(MessagePart::Message(Part { + headers_rfc: headers, + headers_raw, + is_encoding_problem: false, + offset_header: prev_state.offset_header, + offset_body: prev_state.offset_body, + offset_end: message.offset_end, + body: MessageAttachment::Parsed(Box::new(message)), + })); + } + message = prev_message; + state = prev_state; + } else if let Some(mut prev_state) = state_stack.pop() { + if let Some(part_id) = state.part_id { + if let Some(part) = message.parts.get_mut(part_id) { + if let MessagePart::Multipart(ref mut part) = part { + part.offset_end = stream.pos; + } + } else { + debug_assert!(false, "This should not have happened."); + } + } + // Add headers and substructure to parent part + prev_state.structure.push(state.get_structure()); + state = prev_state; + } else { + break; } - message = prev_message; - state = prev_state; } message.raw_message = raw_message.into(); @@ -852,8 +870,8 @@ mod tests { fn raw_parts() { let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); test_dir.push("tests"); - test_dir.push("rfc"); - test_dir.push("002.txt"); + test_dir.push("malformed"); + test_dir.push("007.txt"); let mut input = fs::read(&test_dir).unwrap(); let mut pos = 0; @@ -888,13 +906,14 @@ mod tests { std::str::from_utf8(&raw_message[start..mid]).unwrap(), std::str::from_utf8(&raw_message[mid..end]).unwrap(), match part { - MessagePart::Text(text) | MessagePart::Html(text) => text.body.clone(), - MessagePart::Binary(bin) | MessagePart::InlineBinary(bin) => + 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), - MessagePart::Message(_) | MessagePart::Multipart(_) => "".into(), + crate::MessagePart::Message(_) | crate::MessagePart::Multipart(_) => "".into(), } ); - if let MessagePart::Message(sub) = part { + if let crate::MessagePart::Message(sub) = part { println!("---- FROM ----"); match &sub.body { crate::MessageAttachment::Parsed(message) => { diff --git a/tests/legacy/000.txt b/tests/legacy/000.txt index c4d1e75..8fa3b1a 100644 --- a/tests/legacy/000.txt +++ b/tests/legacy/000.txt @@ -44,27 +44,27 @@ 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" }, - "mime_version": { - "Text": "1.0" - }, "to": { "Address": { "name": "Joe Blow", "address": "jblow@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" - }, "date": { "DateTime": { "year": 2000, @@ -79,6 +79,134 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "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": [ @@ -110,6 +238,35 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 257, + "end": 291 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 317, + "end": 326 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 346, + "end": 385 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1565,7 +1722,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 0, + "offset_body": 578, + "offset_end": 2570 } } ], diff --git a/tests/legacy/001.txt b/tests/legacy/001.txt index 99ee29c..47255e4 100644 --- a/tests/legacy/001.txt +++ b/tests/legacy/001.txt @@ -35,6 +35,18 @@ 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": [ { @@ -60,22 +72,129 @@ m+APw-ssen als wir.+ACI-=20 "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" } }, + "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 ], @@ -100,8 +219,31 @@ m+APw-ssen als wir.+ACI-=20 "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 353, + "end": 383 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 409, + "end": 427 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/002.txt b/tests/legacy/002.txt index 31d07da..65ea5a3 100644 --- a/tests/legacy/002.txt +++ b/tests/legacy/002.txt @@ -37,6 +37,18 @@ 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, @@ -50,28 +62,117 @@ wir."
"tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "subject": { + "Text": "Die Hasen und die Frösche" }, "message_id": { "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, "mime_version": { "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, + "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 ], @@ -83,6 +184,9 @@ wir."
{ "Html": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -91,13 +195,33 @@ wir."
"charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 419, + "end": 453 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 479, + "end": 498 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/003.txt b/tests/legacy/003.txt index 7c208ed..07527da 100644 --- a/tests/legacy/003.txt +++ b/tests/legacy/003.txt @@ -64,6 +64,36 @@ 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, @@ -76,38 +106,100 @@ wir."
"tz_hour": 4, "tz_minute": 0 } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_714967308==_.ALT" - } - } } }, + "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 ], @@ -119,9 +211,6 @@ wir."
{ "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -130,10 +219,36 @@ wir."
"charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 553, + "end": 588 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 614, + "end": 633 + } + ] + ], "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" + "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 } }, { @@ -152,8 +267,31 @@ wir."
} } }, + "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" + "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 } } ], diff --git a/tests/legacy/004.txt b/tests/legacy/004.txt index 036998f..6766b08 100644 --- a/tests/legacy/004.txt +++ b/tests/legacy/004.txt @@ -19,27 +19,21 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" - }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, - "subject": { - "Text": "The Hare and the Tortoise" - }, "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, @@ -52,8 +46,106 @@ Slow but steady wins the race. "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 ], @@ -75,8 +167,22 @@ Slow but steady wins the race. } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 376, + "end": 409 + } + ] + ], "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" + "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 } } ], @@ -84,6 +190,6 @@ Slow but steady wins the race. "Part": 0 }, "offset_header": 0, - "offset_body": 413, + "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 2945df1..d837760 100644 --- a/tests/legacy/005.txt +++ b/tests/legacy/005.txt @@ -33,12 +33,6 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -55,19 +49,144 @@ m+APw-ssen als wir.+ACI-=20 "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" } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@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 ], @@ -92,8 +211,31 @@ m+APw-ssen als wir.+ACI-=20 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 307, + "end": 339 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 365, + "end": 384 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/006.txt b/tests/legacy/006.txt index e998584..6e798c2 100644 --- a/tests/legacy/006.txt +++ b/tests/legacy/006.txt @@ -84,6 +84,33 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- 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, @@ -97,37 +124,120 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "mime_version": { "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" - } - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" } }, + "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": [ @@ -147,9 +257,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -158,8 +265,40 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "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": [ 137, @@ -1487,12 +1626,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 617, + "offset_body": 762, + "offset_end": 2578 } }, { "Binary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1510,11 +1655,37 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2638, + "end": 2672 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 2698, + "end": 2707 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 2727, + "end": 2766 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -2970,7 +3141,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 2625, + "offset_body": 2768, + "offset_end": 4760 } } ], diff --git a/tests/legacy/007.txt b/tests/legacy/007.txt index 6f1f4bf..fb35d32 100644 --- a/tests/legacy/007.txt +++ b/tests/legacy/007.txt @@ -32,6 +32,18 @@ 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" }, @@ -41,9 +53,6 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "address": "doug@example.com" } }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, "date": { "DateTime": { "year": 2000, @@ -56,17 +65,127 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_hour": 4, "tz_minute": 0 } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.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 ], @@ -78,9 +197,6 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -89,10 +205,36 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 408 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/008.txt b/tests/legacy/008.txt index b38666d..f4046c1 100644 --- a/tests/legacy/008.txt +++ b/tests/legacy/008.txt @@ -136,15 +136,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { + "to": { "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" - }, "date": { "DateTime": { "year": 2000, @@ -158,9 +155,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "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", @@ -169,17 +178,118 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" } } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" } }, + "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 ], @@ -195,9 +305,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -206,23 +313,43 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 653, + "end": 690 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 716, + "end": 735 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -233,10 +360,45 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "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 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1657, + "end": 1666 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1686, + "end": 1726 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1564,7 +1726,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 1583, + "offset_body": 1728, + "offset_end": 3544 } }, { @@ -1592,6 +1757,35 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3604, + "end": 3640 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3666, + "end": 3675 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3695, + "end": 3736 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -2892,12 +3086,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3591, + "offset_body": 3738, + "offset_end": 5516 } }, { "Binary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -2915,11 +3115,37 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5576, + "end": 5610 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5636, + "end": 5645 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5665, + "end": 5704 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4375,7 +4601,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 5563, + "offset_body": 5706, + "offset_end": 7698 } } ], diff --git a/tests/legacy/009.txt b/tests/legacy/009.txt index c78f594..7ed7106 100644 --- a/tests/legacy/009.txt +++ b/tests/legacy/009.txt @@ -43,12 +43,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "address": "dwsauder@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "date": { "DateTime": { "year": 2000, @@ -62,9 +56,15 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "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", @@ -72,6 +72,116 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." } } }, + "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 ], @@ -91,14 +201,37 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "c_type": "text", "c_subtype": "plain", "attributes": { - "charset": "iso-8859-1", - "format": "flowed" + "format": "flowed", + "charset": "iso-8859-1" } } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 500, + "end": 550 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 576, + "end": 595 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/010.txt b/tests/legacy/010.txt index 8a63a1e..8d92528 100644 --- a/tests/legacy/010.txt +++ b/tests/legacy/010.txt @@ -25,17 +25,8 @@ In einem nahen Teich wollten sie sich nun ers "subject": { "Text": "Die Hasen und die Fr�sche" }, - "to": { - "Address": { - "name": "Heinz M�ller", - "address": "mueller@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "mime_version": { + "Text": "1.0" }, "date": { "DateTime": { @@ -50,13 +41,123 @@ In einem nahen Teich wollten sie sich nun ers "tz_minute": 0 } }, - "mime_version": { - "Text": "1.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 ], @@ -68,6 +169,9 @@ In einem nahen Teich wollten sie sich nun ers { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "8bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -76,13 +180,33 @@ In einem nahen Teich wollten sie sich nun ers "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "8bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 384, + "end": 419 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 445, + "end": 452 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/011.txt b/tests/legacy/011.txt index a3f4bbd..64b0dd3 100644 --- a/tests/legacy/011.txt +++ b/tests/legacy/011.txt @@ -33,15 +33,18 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "mime_version": { "Text": "1.0" }, - "message_id": { - "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" - }, "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, @@ -60,11 +63,100 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "name": "Doug Sauder", "address": "dwsauder@example.com" } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, + "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 ], @@ -89,8 +181,31 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 428, + "end": 463 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 489, + "end": 508 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/012.txt b/tests/legacy/012.txt index 3dd6f7b..2434354 100644 --- a/tests/legacy/012.txt +++ b/tests/legacy/012.txt @@ -31,6 +31,12 @@ 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", @@ -50,22 +56,135 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_minute": 0 } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "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 ], @@ -77,9 +196,6 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -88,10 +204,36 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "charset": "Windows-1252" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 317, + "end": 356 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 382, + "end": 401 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/013.txt b/tests/legacy/013.txt index e55bc9f..8981663 100644 --- a/tests/legacy/013.txt +++ b/tests/legacy/013.txt @@ -35,9 +35,24 @@ welche also wohl noch ungl "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, @@ -50,23 +65,127 @@ welche also wohl noch ungl "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" - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } } }, + "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 ], @@ -78,9 +197,6 @@ welche also wohl noch ungl { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "8bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -89,10 +205,36 @@ welche also wohl noch ungl "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "8bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 396 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/014.txt b/tests/legacy/014.txt index f315d7b..20e7f75 100644 --- a/tests/legacy/014.txt +++ b/tests/legacy/014.txt @@ -73,18 +73,18 @@ race. =20 ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" - }, "subject": { "Text": "Test message from Microsoft Outlook 00" }, @@ -101,6 +101,9 @@ race. =20 "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -110,13 +113,120 @@ race. =20 } } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } + "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 ], @@ -141,8 +251,31 @@ race. =20 "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 636, + "end": 673 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 699, + "end": 718 + } + ] + ], "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" + "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 } }, { @@ -161,8 +294,31 @@ race. =20 "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1581, + "end": 1617 + } + ], + [ + { + "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" + "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 } } ], diff --git a/tests/legacy/015.txt b/tests/legacy/015.txt index 9c56bd5..8dad01c 100644 --- a/tests/legacy/015.txt +++ b/tests/legacy/015.txt @@ -199,8 +199,14 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" + "message_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } }, "date": { "DateTime": { @@ -215,14 +221,11 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "message_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" + "subject": { + "Text": "Die Hasen und die Frösche" }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } + "mime_version": { + "Text": "1.0" }, "content_type": { "ContentType": { @@ -238,11 +241,100 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "Doug Sauder", "address": "dwsauder@example.com" } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, + "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 ], @@ -269,7 +361,21 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 535, + "end": 640 + } + ] + ], + "offset_header": 522, + "offset_body": 642, + "offset_end": 7504 } }, { @@ -284,7 +390,21 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 697, + "end": 774 + } + ] + ], + "offset_header": 684, + "offset_body": 776, + "offset_end": 3160 } }, { @@ -303,8 +423,31 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "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" + "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 } }, { @@ -323,13 +466,39 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1803, + "end": 1837 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1863, + "end": 1882 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -339,9 +508,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -351,10 +517,48 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3217, + "end": 3250 + } + ], + [ + { + "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": [ 137, @@ -1682,20 +1886,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 3204, + "offset_body": 3407, + "offset_end": 5221 } }, { "Binary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa3edd1.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -1706,13 +1907,57 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" + "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 + } + ], + [ + { + "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": [ 137, @@ -3168,20 +3413,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 5265, + "offset_body": 5468, + "offset_end": 7458 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_type": { "ContentType": { @@ -3192,10 +3434,45 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7557, + "end": 7590 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 7616, + "end": 7625 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 7645, + "end": 7683 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4523,12 +4800,24 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 7544, + "offset_body": 7685, + "offset_end": 9499 } }, { "Binary": { "headers_rfc": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -4540,17 +4829,37 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 9552, + "end": 9586 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 9612, + "end": 9621 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 9641, + "end": 9680 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -5851,7 +6160,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 9539, + "offset_body": 9682, + "offset_end": 11458 } } ], diff --git a/tests/legacy/016.txt b/tests/legacy/016.txt index 1a3052f..d6b7a6e 100644 --- a/tests/legacy/016.txt +++ b/tests/legacy/016.txt @@ -96,14 +96,11 @@ JB@ac)(GTFLiL)!d09'8!!!: ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716373961==_" - } - } + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "message_id": { + "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" }, "from": { "Address": { @@ -111,18 +108,6 @@ JB@ac)(GTFLiL)!d09'8!!!: "address": "dwsauder@example.com" } }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" - }, "date": { "DateTime": { "year": 2000, @@ -136,10 +121,108 @@ JB@ac)(GTFLiL)!d09'8!!!: "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": "=====================_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 ], @@ -167,22 +250,36 @@ JB@ac)(GTFLiL)!d09'8!!!: } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 542, + "end": 577 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 603, + "end": 622 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "application", @@ -191,8 +288,37 @@ JB@ac)(GTFLiL)!d09'8!!!: "name": "blueball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1486, + "end": 1534 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1554, + "end": 1592 + } + ] + ], "is_encoding_problem": false, "body": [ 13, @@ -2124,21 +2250,15 @@ JB@ac)(GTFLiL)!d09'8!!!: 58, 13, 10 - ] + ], + "offset_header": 1473, + "offset_body": 1594, + "offset_end": 3523 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "HasenundFr�sche.txt" - } - } - }, "content_type": { "ContentType": { "c_type": "application", @@ -2147,8 +2267,37 @@ JB@ac)(GTFLiL)!d09'8!!!: "name": "HasenundFr�sche.txt" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "HasenundFr�sche.txt" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3576, + "end": 3631 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3651, + "end": 3696 + } + ] + ], "is_encoding_problem": false, "body": [ 13, @@ -3282,7 +3431,10 @@ JB@ac)(GTFLiL)!d09'8!!!: 58, 13, 10 - ] + ], + "offset_header": 3563, + "offset_body": 3698, + "offset_end": 4829 } } ], diff --git a/tests/legacy/017.txt b/tests/legacy/017.txt index 00f7221..2e0aa8a 100644 --- a/tests/legacy/017.txt +++ b/tests/legacy/017.txt @@ -103,15 +103,27 @@ 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" } }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -125,18 +137,6 @@ end "tz_minute": 0 } }, - "message_id": { - "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "jschmuergen@example.com" - } - }, - "subject": { - "Text": "The Hare and the Tortoise" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -147,6 +147,89 @@ end } } }, + "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 ], @@ -171,13 +254,30 @@ end } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 487, + "end": 520 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "x-uuencode" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -187,9 +287,6 @@ end } } }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -200,6 +297,35 @@ end } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1339, + "end": 1373 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1399, + "end": 1412 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1432, + "end": 1471 + } + ] + ], "is_encoding_problem": false, "body": [ 13, @@ -2056,21 +2182,15 @@ end 100, 13, 10 - ] + ], + "offset_header": 1326, + "offset_body": 1473, + "offset_end": 3327 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -2082,8 +2202,46 @@ end }, "content_transfer_encoding": { "Text": "x-uuencode" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3380, + "end": 3413 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3439, + "end": 3452 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3472, + "end": 3510 + } + ] + ], "is_encoding_problem": false, "body": [ 13, @@ -3978,7 +4136,10 @@ end 100, 13, 10 - ] + ], + "offset_header": 3367, + "offset_body": 3512, + "offset_end": 5404 } } ], diff --git a/tests/legacy/018.txt b/tests/legacy/018.txt index 1df7bc1..78973d1 100644 --- a/tests/legacy/018.txt +++ b/tests/legacy/018.txt @@ -139,14 +139,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" + "message_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" }, "content_type": { "ContentType": { @@ -158,8 +152,14 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } }, "date": { "DateTime": { @@ -174,16 +174,108 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "message_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" - }, - "to": { + "from": { "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" + "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 ], @@ -207,7 +299,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 577, + "end": 654 + } + ] + ], + "offset_header": 564, + "offset_body": 656, + "offset_end": 3051 } }, { @@ -226,16 +332,36 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "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" + "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 } }, { "Html": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -244,30 +370,44 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1686, + "end": 1720 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1746, + "end": 1765 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, "content_id": { "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -276,8 +416,58 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "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": 3108, + "end": 3141 + } + ], + [ + { + "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": [ 137, @@ -1605,15 +1795,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3095, + "offset_body": 3298, + "offset_end": 5112 } }, { "Binary": { "headers_rfc": { - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1623,6 +1813,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" + }, "content_transfer_encoding": { "Text": "base64" }, @@ -1636,6 +1829,44 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5169, + "end": 5201 + } + ], + [ + { + "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": [ 137, @@ -3091,7 +3322,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 5156, + "offset_body": 5357, + "offset_end": 7347 } } ], diff --git a/tests/legacy/019.txt b/tests/legacy/019.txt index 907a8e8..8d65493 100644 --- a/tests/legacy/019.txt +++ b/tests/legacy/019.txt @@ -145,6 +145,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -154,6 +160,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "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, @@ -169,26 +187,118 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== }, "mime_version": { "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@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": 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 ], @@ -212,7 +322,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 630, + "end": 710 + } + ] + ], + "offset_header": 617, + "offset_body": 712, + "offset_end": 3039 } }, { @@ -231,16 +355,36 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "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" + "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 } }, { "Html": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -249,10 +393,36 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1717, + "end": 1753 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1779, + "end": 1798 + } + ] + ], "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" + "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 } }, { @@ -261,15 +431,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_transfer_encoding": { "Text": "base64" }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -278,8 +439,46 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "greenball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3099, + "end": 3135 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3161, + "end": 3170 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3190, + "end": 3231 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1580,14 +1779,23 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3086, + "offset_body": 3233, + "offset_end": 5011 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "redball.png" + } + } }, "content_type": { "ContentType": { @@ -1598,16 +1806,39 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "redball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5071, + "end": 5105 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5131, + "end": 5140 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5160, + "end": 5199 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -3063,7 +3294,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 5058, + "offset_body": 5201, + "offset_end": 7193 } } ], diff --git a/tests/legacy/020.txt b/tests/legacy/020.txt index cbd7015..462717e 100644 --- a/tests/legacy/020.txt +++ b/tests/legacy/020.txt @@ -38,12 +38,18 @@ welche also wohl noch ungl "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" }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, "date": { "DateTime": { "year": 2000, @@ -57,16 +63,129 @@ welche also wohl noch ungl "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "mime_version": { - "Text": "1.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 ], @@ -78,6 +197,9 @@ welche also wohl noch ungl { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "8bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -86,13 +208,33 @@ welche also wohl noch ungl "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "8bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 280, + "end": 317 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 343, + "end": 350 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/021.txt b/tests/legacy/021.txt index 950c18b..dcb5c32 100644 --- a/tests/legacy/021.txt +++ b/tests/legacy/021.txt @@ -189,6 +189,27 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- 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, @@ -202,12 +223,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -216,23 +231,118 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" } } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@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": 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 ], @@ -257,7 +367,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 630, + "end": 706 + } + ] + ], + "offset_header": 617, + "offset_body": 708, + "offset_end": 5424 } }, { @@ -272,7 +396,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 768, + "end": 848 + } + ] + ], + "offset_header": 755, + "offset_body": 850, + "offset_end": 3388 } }, { @@ -291,16 +429,36 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "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" + "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 } }, { "Html": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -309,10 +467,36 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1859, + "end": 1895 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1921, + "end": 1940 + } + ] + ], "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" + "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 } }, { @@ -327,13 +511,42 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_id": { "Text": "938014623@17052000-0f9b" + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "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": [ 137, @@ -1661,14 +1874,23 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3435, + "offset_body": 3559, + "offset_end": 5375 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } + } }, "content_disposition": { "ContentType": { @@ -1679,16 +1901,39 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5484, + "end": 5520 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5546, + "end": 5555 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5575, + "end": 5616 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -2989,21 +3234,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 5471, + "offset_body": 5618, + "offset_end": 7396 } }, { "Binary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -3015,8 +3254,46 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7456, + "end": 7490 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 7516, + "end": 7525 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 7545, + "end": 7584 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4472,7 +4749,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 7443, + "offset_body": 7586, + "offset_end": 9578 } } ], diff --git a/tests/legacy/022.txt b/tests/legacy/022.txt index fa6945e..7676fa8 100644 --- a/tests/legacy/022.txt +++ b/tests/legacy/022.txt @@ -31,6 +31,15 @@ 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, @@ -47,25 +56,135 @@ IiANCg== "mime_version": { "Text": "1.0" }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.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 ], @@ -77,9 +196,6 @@ IiANCg== { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "text", @@ -88,10 +204,36 @@ IiANCg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 280, + "end": 317 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 343, + "end": 352 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/023.txt b/tests/legacy/023.txt index 2d4dea4..fdea7e7 100644 --- a/tests/legacy/023.txt +++ b/tests/legacy/023.txt @@ -109,30 +109,12 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716541962==_" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -146,13 +128,114 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "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 ], @@ -181,22 +264,36 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 542, + "end": 577 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 603, + "end": 622 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -208,8 +305,46 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= }, "content_transfer_encoding": { "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1486, + "end": 1519 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1545, + "end": 1554 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1574, + "end": 1612 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1537,21 +1672,15 @@ 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 } }, { "Text": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1560,24 +1689,47 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "filename": "farmerandstork.txt" } } - } - }, - "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" - } - }, - { - "Text": { - "headers_rfc": { + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": { - "charset": "iso-8859-1" + "charset": "us-ascii" } } - }, + } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3481, + "end": 3514 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3534, + "end": 3578 + } + ] + ], + "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 + } + }, + { + "Text": { + "headers_rfc": { "content_transfer_encoding": { "Text": "quoted-printable" }, @@ -1589,10 +1741,51 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "filename": "HasenundFr�sche.txt" } } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4437, + "end": 4472 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 4498, + "end": 4517 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 4537, + "end": 4582 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/024.txt b/tests/legacy/024.txt index 148bf56..97ccdef 100644 --- a/tests/legacy/024.txt +++ b/tests/legacy/024.txt @@ -110,15 +110,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "=====================_715429112==_.REL", - "type": "text/html" - } - } + "mime_version": { + "Text": "1.0" }, "date": { "DateTime": { @@ -133,28 +126,127 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "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" } }, - "mime_version": { - "Text": "1.0" - }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche" + "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 ], @@ -182,8 +274,31 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 565, + "end": 599 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 625, + "end": 644 + } + ] + ], "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" + "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 } }, { @@ -192,6 +307,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_id": { "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -209,11 +327,46 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "2aa48eb6.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1942, + "end": 1975 + } + ], + [ + { + "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": [ 137, @@ -1541,7 +1694,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 1929, + "offset_body": 2132, + "offset_end": 3946 } }, { @@ -1556,9 +1712,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1568,10 +1721,51 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "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 + } + ], + [ + { + "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": [ 137, @@ -3027,7 +3221,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3990, + "offset_body": 4193, + "offset_end": 6183 } } ], diff --git a/tests/legacy/025.txt b/tests/legacy/025.txt index 3642a09..47f70f2 100644 --- a/tests/legacy/025.txt +++ b/tests/legacy/025.txt @@ -181,15 +181,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "date": { "DateTime": { "year": 2000, @@ -203,8 +194,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "Die Hasen und die Frösche" }, "message_id": { "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" @@ -214,8 +205,109 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "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 ], @@ -237,20 +329,31 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715462801==_.REL", - "type": "text/html" + "type": "text/html", + "boundary": "=====================_715462801==_.REL" } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 535, + "end": 628 + } + ] + ], + "offset_header": 522, + "offset_body": 630, + "offset_end": 6340 } }, { "Html": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -259,18 +362,41 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } + }, + "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -291,8 +417,49 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa51367.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2053, + "end": 2086 + } + ], + [ + { + "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": [ 137, @@ -1620,12 +1787,27 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 2040, + "offset_body": 2243, + "offset_end": 4057 } }, { "Binary": { "headers_rfc": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa51371.png" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -1637,20 +1819,46 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_id": { "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa51371.png" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4114, + "end": 4147 + } + ], + [ + { + "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": [ 137, @@ -3106,7 +3314,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 4101, + "offset_body": 4304, + "offset_end": 6294 } }, { @@ -3134,6 +3345,35 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 6393, + "end": 6426 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 6452, + "end": 6461 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 6481, + "end": 6519 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4461,7 +4701,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 6380, + "offset_body": 6521, + "offset_end": 8335 } }, { @@ -4489,6 +4732,35 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 8388, + "end": 8422 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 8448, + "end": 8457 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 8477, + "end": 8516 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -5789,7 +6061,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 8375, + "offset_body": 8518, + "offset_end": 10294 } } ], diff --git a/tests/legacy/026.txt b/tests/legacy/026.txt index eaecdc3..bd1e52b 100644 --- a/tests/legacy/026.txt +++ b/tests/legacy/026.txt @@ -85,21 +85,24 @@ 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" }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716740438==_" - } + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -113,22 +116,102 @@ Birds of a feather flock together. "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716740438==_" + } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005818.00a86aa0@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 + } + ], + [ + { + "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 ], @@ -156,13 +239,50 @@ Birds of a feather flock together. } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 513, + "end": 548 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 574, + "end": 593 + } + ] + ], "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" + "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 } }, { "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", @@ -171,24 +291,42 @@ Birds of a feather flock together. "filename": "HasenundFr�sche.txt" } } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "x-mac-type": "54455854", - "name": "HasenundFr�sche.txt", - "x-mac-creator": "74747874" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1457, + "end": 1549 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1575, + "end": 1588 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1608, + "end": 1653 + } + ] + ], "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" + "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.  
\n
 
\n
\"blue
 
Slow but steady wins \nthe race. 
\n
 
\n
\"red
\n", + "offset_header": 1714, + "offset_body": 1810, + "offset_end": 3386 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" + "content_id": { + "Text": "823504223@17052000-0f8d" }, "content_type": { "ContentType": { @@ -282,10 +452,39 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "823504223@17052000-0f8d" + "content_transfer_encoding": { + "Text": "base64" } }, + "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": [ 137, @@ -1613,7 +1812,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3482, + "offset_body": 3606, + "offset_end": 5422 } }, { @@ -1628,13 +1830,42 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "823504223@17052000-0f94" - }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "823504223@17052000-0f94" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5482, + "end": 5516 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5542, + "end": 5551 + } + ], + [ + { + "Rfc": "content_id" + }, + { + "start": 5562, + "end": 5590 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -3090,7 +3321,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 5469, + "offset_body": 5592, + "offset_end": 7584 } } ], diff --git a/tests/legacy/029.txt b/tests/legacy/029.txt index aa79a57..9eb0c83 100644 --- a/tests/legacy/029.txt +++ b/tests/legacy/029.txt @@ -28,21 +28,6 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "message_id": { - "Text": "392362D8.B650789F@example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "from": { "Address": { "name": "Doug Sauder", @@ -61,8 +46,124 @@ Slow but steady wins the race. "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 ], @@ -74,9 +175,6 @@ Slow but steady wins the race. { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -85,10 +183,36 @@ Slow but steady wins the race. "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 332, + "end": 363 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 389, + "end": 396 + } + ] + ], "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" + "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 } } ], @@ -96,6 +220,6 @@ Slow but steady wins the race. "Part": 0 }, "offset_header": 0, - "offset_body": 400, + "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 2b00c92..62c6905 100644 --- a/tests/legacy/030.txt +++ b/tests/legacy/030.txt @@ -112,29 +112,11 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "message_id": { - "Text": "3923635B.85C58444@example.com" - }, "subject": { "Text": "Test message from Netscape Communicator 4.7" }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------0BBC657DDC74A0B8454627FD" - } - } + "mime_version": { + "Text": "1.0" }, "from": { "Address": { @@ -154,8 +136,109 @@ Slow but steady wins the race. "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, @@ -175,6 +258,9 @@ Slow but steady wins the race. { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -183,27 +269,38 @@ Slow but steady wins the race. "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 508 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 534, + "end": 541 + } + ] + ], "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." + "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 } }, { "InlineBinary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -215,8 +312,46 @@ Slow but steady wins the race. "name": "blueball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1365, + "end": 1400 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1426, + "end": 1435 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1455, + "end": 1491 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1544,21 +1679,15 @@ Slow but steady wins the race. 66, 96, 130 - ] + ], + "offset_header": 1352, + "offset_body": 1493, + "offset_end": 3309 } }, { "InlineBinary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -1570,8 +1699,46 @@ Slow but steady wins the race. "name": "greenball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3364, + "end": 3400 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3426, + "end": 3435 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3455, + "end": 3492 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -2872,12 +3039,18 @@ Slow but steady wins the race. 66, 96, 130 - ] + ], + "offset_header": 3351, + "offset_body": 3494, + "offset_end": 5274 } }, { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -2888,9 +3061,6 @@ Slow but steady wins the race. } } }, - "content_transfer_encoding": { - "Text": "7bit" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -2901,8 +3071,40 @@ Slow but steady wins the race. } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5329, + "end": 5389 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5415, + "end": 5422 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5442, + "end": 5484 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/031.txt b/tests/legacy/031.txt index 03b4414..a4a8360 100644 --- a/tests/legacy/031.txt +++ b/tests/legacy/031.txt @@ -97,10 +97,13 @@ Z3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "-1463757054-952513540-958744548=:8452" + } } }, "date": { @@ -116,31 +119,93 @@ Z3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "subject": { - "Text": "Test message from PINE" - }, - "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" - } - } - }, "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 ], @@ -165,19 +230,27 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 608, + "end": 639 + } + ] + ], "is_encoding_problem": false, - "body": "This is a test message from PINE MUA.\r\n\r\n" + "body": "This is a test message from PINE MUA.\r\n\r\n", + "offset_header": 595, + "offset_body": 641, + "offset_end": 682 } }, { "Binary": { "headers_rfc": { - "content_id": { - "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" - }, - "content_description": { - "Text": "A PNG graphic file" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -187,6 +260,9 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_description": { + "Text": "A PNG graphic file" + }, "content_type": { "ContentType": { "c_type": "application", @@ -198,8 +274,58 @@ Z3VldDZzO7wAAAAASUVORK5CYII= }, "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 + } + ], + [ + { + "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": [ 137, @@ -1655,30 +1781,18 @@ Z3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 725, + "offset_body": 988, + "offset_end": 2992 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "BASE64" - }, "content_id": { "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" }, - "content_description": { - "Text": "A PNG graphic file" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "blueball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1687,8 +1801,70 @@ Z3VldDZzO7wAAAAASUVORK5CYII= "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_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3048, + "end": 3096 + } + ], + [ + { + "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": [ 137, @@ -3016,7 +3192,10 @@ Z3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 3035, + "offset_body": 3300, + "offset_end": 5126 } } ], @@ -3034,6 +3213,6 @@ Z3VldDZzO7wAAAAASUVORK5CYII= ] }, "offset_header": 0, - "offset_body": 336, + "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 f04bd14..07e1393 100644 --- a/tests/legacy/032.txt +++ b/tests/legacy/032.txt @@ -134,33 +134,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------C78F594988075E36AE03C243" - } - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -174,10 +147,120 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "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, @@ -205,12 +288,29 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 552 + } + ] + ], + "offset_header": 464, + "offset_body": 554, + "offset_end": 2600 } }, { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -219,13 +319,33 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, + "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" + "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 } }, { @@ -244,22 +364,36 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1542, + "end": 1572 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1598, + "end": 1605 + } + ] + ], "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" + "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 } }, { "InlineBinary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -269,10 +403,48 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2655, + "end": 2691 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 2717, + "end": 2726 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 2746, + "end": 2783 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1573,21 +1745,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 2642, + "offset_body": 2785, + "offset_end": 4565 } }, { "InlineBinary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -1599,8 +1765,46 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4620, + "end": 4655 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 4681, + "end": 4690 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 4710, + "end": 4746 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -2928,7 +3132,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 4607, + "offset_body": 4748, + "offset_end": 6564 } } ], diff --git a/tests/legacy/033.txt b/tests/legacy/033.txt index 8ba3133..ff47fb6 100644 --- a/tests/legacy/033.txt +++ b/tests/legacy/033.txt @@ -34,8 +34,8 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "message_id": { - "Text": "392363E1.2AC47AB3@example.com" + "mime_version": { + "Text": "1.0" }, "from": { "Address": { @@ -43,12 +43,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "address": "dwsauder@example.com" } }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "to": { "Address": { "name": "Joe Blow", @@ -67,8 +61,115 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "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 ], @@ -80,9 +181,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -91,10 +189,36 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "charset": "UTF-8" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 331, + "end": 359 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 385, + "end": 404 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/034.txt b/tests/legacy/034.txt index 54ff7e8..40f55cb 100644 --- a/tests/legacy/034.txt +++ b/tests/legacy/034.txt @@ -27,6 +27,21 @@ 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", @@ -45,23 +60,100 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." "tz_hour": 4, "tz_minute": 0 } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Fr+APY-sche" - }, - "message_id": { - "Text": "39236497.12FA2A89@example.com" - }, - "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": 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 ], @@ -73,6 +165,9 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -81,13 +176,33 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." "charset": "UTF-7" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 306, + "end": 334 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 360, + "end": 367 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/035.txt b/tests/legacy/035.txt index 93105b3..01878e0 100644 --- a/tests/legacy/035.txt +++ b/tests/legacy/035.txt @@ -213,12 +213,6 @@ YII= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -232,15 +226,6 @@ YII= "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" - }, "mime_version": { "Text": "1.0" }, @@ -255,8 +240,106 @@ YII= }, "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, @@ -286,7 +369,21 @@ YII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 529, + "end": 604 + } + ] + ], + "offset_header": 516, + "offset_body": 606, + "offset_end": 7265 } }, { @@ -305,8 +402,31 @@ YII= "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" + "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 } }, { @@ -321,7 +441,21 @@ YII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1620, + "end": 1691 + } + ] + ], + "offset_header": 1607, + "offset_body": 1693, + "offset_end": 7221 } }, { @@ -340,23 +474,36 @@ YII= "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_id": { - "Text": "part1.39235FC5.E71D8178@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": null - } - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -366,10 +513,58 @@ YII= } } }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": null + } + }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "part1.39235FC5.E71D8178@example.com" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2990, + "end": 3002 + } + ], + [ + { + "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": [ 137, @@ -1697,12 +1892,21 @@ YII= 66, 96, 130 - ] + ], + "offset_header": 2977, + "offset_body": 3152, + "offset_end": 4968 } }, { "Binary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "part2.39235FC5.E71D8178@example.com" + }, "content_type": { "ContentType": { "c_type": "image", @@ -1710,12 +1914,6 @@ YII= "attributes": null } }, - "content_id": { - "Text": "part2.39235FC5.E71D8178@example.com" - }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1726,6 +1924,44 @@ YII= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5023, + "end": 5035 + } + ], + [ + { + "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": [ 137, @@ -3181,12 +3417,24 @@ YII= 66, 96, 130 - ] + ], + "offset_header": 5010, + "offset_body": 5185, + "offset_end": 7177 } }, { "InlineBinary": { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -3198,17 +3446,37 @@ YII= }, "content_transfer_encoding": { "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7320, + "end": 7354 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 7380, + "end": 7389 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 7409, + "end": 7444 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4664,7 +4932,10 @@ YII= 66, 96, 130 - ] + ], + "offset_header": 7307, + "offset_body": 7446, + "offset_end": 9438 } }, { @@ -4673,15 +4944,6 @@ YII= "content_transfer_encoding": { "Text": "base64" }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -4690,8 +4952,46 @@ YII= "name": "greenball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 9493, + "end": 9529 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 9555, + "end": 9564 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 9584, + "end": 9621 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -5992,7 +6292,10 @@ YII= 66, 96, 130 - ] + ], + "offset_header": 9480, + "offset_body": 9623, + "offset_end": 11403 } } ], diff --git a/tests/legacy/036.txt b/tests/legacy/036.txt index d088b86..c89e1f2 100644 --- a/tests/legacy/036.txt +++ b/tests/legacy/036.txt @@ -27,15 +27,18 @@ 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" } }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" - }, "mime_version": { "Text": "1.0" }, @@ -55,13 +58,84 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "subject": { "Text": "Die Hasen und die Frösche" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } + "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 ], @@ -73,9 +147,6 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "QUOTED-PRINTABLE" - }, "content_type": { "ContentType": { "c_type": "text", @@ -84,10 +155,36 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "QUOTED-PRINTABLE" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 321, + "end": 354 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 380, + "end": 399 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/037.txt b/tests/legacy/037.txt index 15023a2..872b18a 100644 --- a/tests/legacy/037.txt +++ b/tests/legacy/037.txt @@ -61,11 +61,8 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "mime_version": { + "Text": "1.0" }, "message_id": { "Text": "392366A7.21929EA7@example.com" @@ -83,19 +80,105 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "mime_version": { - "Text": "1.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" } - }, - "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 @@ -111,9 +194,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -122,18 +202,41 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 508 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 534, + "end": 541 + } + ] + ], "is_encoding_problem": false, - "body": " " + "body": " ", + "offset_header": 464, + "offset_body": 543, + "offset_end": 544 } }, { "InlineBinary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -143,6 +246,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -153,6 +259,35 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 599, + "end": 634 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 660, + "end": 669 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 689, + "end": 725 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1480,7 +1615,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 586, + "offset_body": 727, + "offset_end": 2543 } } ], diff --git a/tests/legacy/038.txt b/tests/legacy/038.txt index 9b7749d..cd00558 100644 --- a/tests/legacy/038.txt +++ b/tests/legacy/038.txt @@ -18,18 +18,9 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "mime_version": { "Text": "1.0" }, - "message_id": { - "Text": "3923625B.59F0C3AC@example.com" - }, "to": { "Address": { "name": "Joe Blow", @@ -49,10 +40,111 @@ Slow but steady wins the race. "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 ], @@ -64,6 +156,9 @@ Slow but steady wins the race. { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -72,13 +167,33 @@ Slow but steady wins the race. "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 307, + "end": 338 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 364, + "end": 371 + } + ] + ], "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" + "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 } } ], @@ -86,6 +201,6 @@ Slow but steady wins the race. "Part": 0 }, "offset_header": 0, - "offset_body": 375, + "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 40ea4d9..46a13fc 100644 --- a/tests/legacy/039.txt +++ b/tests/legacy/039.txt @@ -172,9 +172,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -184,15 +181,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "mime_version": { + "Text": "1.0" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, - "message_id": { - "Text": "39236103.FFE674FC@example.com" - }, "date": { "DateTime": { "year": 2000, @@ -206,16 +203,102 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "mime_version": { - "Text": "1.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, @@ -245,7 +328,21 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 514, + "end": 585 + } + ] + ], + "offset_header": 501, + "offset_body": 587, + "offset_end": 6127 } }, { @@ -264,13 +361,42 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "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" + "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 } }, { "Binary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "part1.39236103.1B697A54@example.com" + }, "content_type": { "ContentType": { "c_type": "image", @@ -278,9 +404,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "attributes": null } }, - "content_id": { - "Text": "part1.39236103.1B697A54@example.com" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -289,11 +412,46 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "C:TEMPnsmailV0.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "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": [ 137, @@ -1621,7 +1779,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 1883, + "offset_body": 2058, + "offset_end": 3874 } }, { @@ -1650,6 +1811,44 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3929, + "end": 3941 + } + ], + [ + { + "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": [ 137, @@ -3105,20 +3304,17 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 3916, + "offset_body": 4091, + "offset_end": 6083 } }, { "InlineBinary": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -3129,10 +3325,45 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "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 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 6244, + "end": 6253 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 6273, + "end": 6310 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4433,12 +4664,18 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 6169, + "offset_body": 6312, + "offset_end": 8092 } }, { "InlineBinary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -4456,11 +4693,37 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 8147, + "end": 8182 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 8208, + "end": 8217 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 8237, + "end": 8273 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -5788,7 +6051,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 8134, + "offset_body": 8275, + "offset_end": 10091 } } ], diff --git a/tests/legacy/040.txt b/tests/legacy/040.txt index 669d61b..cb3a9a4 100644 --- a/tests/legacy/040.txt +++ b/tests/legacy/040.txt @@ -29,6 +29,24 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- 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, @@ -42,28 +60,102 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_minute": 0 } }, - "message_id": { - "Text": "39236653.CAA8A090@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, "subject": { "Text": "Die Hasen und die Frösche" - }, - "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": 332 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 345, + "end": 378 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 404, + "end": 423 + } + ] + ], "html_body": [ 0 ], @@ -75,6 +167,9 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -83,13 +178,33 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 345, + "end": 378 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 404, + "end": 423 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/041.txt b/tests/legacy/041.txt index 4c61353..6379578 100644 --- a/tests/legacy/041.txt +++ b/tests/legacy/041.txt @@ -58,12 +58,33 @@ vAAAAABJRU5ErkJggg== ---- 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, @@ -77,31 +98,75 @@ vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, "subject": { "Text": "PNG graphic" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-170444605-958746196=:8452" - } - } - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } } }, + "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 ], @@ -125,22 +190,27 @@ vAAAAABJRU5ErkJggg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 623, + "end": 654 + } + ] + ], "is_encoding_problem": false, - "body": "\n" + "body": "\n", + "offset_header": 610, + "offset_body": 656, + "offset_end": 656 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_description": { - "Text": "red ball" - }, - "content_id": { - "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -150,6 +220,15 @@ vAAAAABJRU5ErkJggg== } } }, + "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", @@ -160,6 +239,53 @@ vAAAAABJRU5ErkJggg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 712, + "end": 759 + } + ], + [ + { + "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": [ 137, @@ -1615,7 +1741,10 @@ vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 699, + "offset_body": 952, + "offset_end": 2956 } } ], @@ -1630,6 +1759,6 @@ vAAAAABJRU5ErkJggg== ] }, "offset_header": 0, - "offset_body": 351, + "offset_body": 349, "offset_end": 2999 } \ No newline at end of file diff --git a/tests/legacy/042.txt b/tests/legacy/042.txt index f227b4e..3ab6182 100644 --- a/tests/legacy/042.txt +++ b/tests/legacy/042.txt @@ -59,18 +59,21 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "message_id": { - "Text": "3923686C.99FB5E36@example.com" - }, - "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": "------------77060D866A66DC8D0921E051" + } + } + }, "subject": { "Text": "Test message from Netscape Communicator 4.7" }, @@ -93,16 +96,96 @@ Birds of a feather flock together. "address": "dwsauder@example.com" } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------77060D866A66DC8D0921E051" - } - } + "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 ], @@ -129,8 +212,31 @@ Birds of a feather flock together. "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 508 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 534, + "end": 541 + } + ] + ], "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." + "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 } }, { @@ -159,8 +265,40 @@ Birds of a feather flock together. } } }, + "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": "\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" + "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 } } ], diff --git a/tests/legacy/043.txt b/tests/legacy/043.txt index 38af478..558865d 100644 --- a/tests/legacy/043.txt +++ b/tests/legacy/043.txt @@ -62,8 +62,14 @@ als wir." ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "------------9D454F23DA86BCD63FA3805F" + } + } }, "from": { "Address": { @@ -87,14 +93,8 @@ als wir." "mime_version": { "Text": "1.0" }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "------------9D454F23DA86BCD63FA3805F" - } - } + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" }, "message_id": { "Text": "392359CF.DFF4527@example.com" @@ -106,6 +106,89 @@ als wir." } } }, + "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 ], @@ -130,13 +213,39 @@ als wir." } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 493, + "end": 526 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 552, + "end": 571 + } + ] + ], "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" + "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 } }, { "Html": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -145,13 +254,33 @@ als wir." "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, + "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" + "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 } } ], @@ -166,6 +295,6 @@ als wir." ] }, "offset_header": 0, - "offset_body": 440, + "offset_body": 438, "offset_end": 2482 } \ No newline at end of file diff --git a/tests/legacy/044.txt b/tests/legacy/044.txt index 24dfb97..7b203e2 100644 --- a/tests/legacy/044.txt +++ b/tests/legacy/044.txt @@ -147,18 +147,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "address": "blow@example.com" } }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------A1FCDEE154E03D875E5D6779" - } + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, "date": { "DateTime": { "year": 2000, @@ -172,16 +169,102 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "mime_version": { + "Text": "1.0" }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" + "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, @@ -216,8 +299,31 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 510 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 536, + "end": 555 + } + ] + ], "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" + "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 } }, { @@ -232,9 +338,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -243,8 +346,40 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "redball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1410, + "end": 1444 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1470, + "end": 1479 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1499, + "end": 1534 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -1700,12 +1835,24 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 1397, + "offset_body": 1536, + "offset_end": 3528 } }, { "InlineBinary": { "headers_rfc": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -1717,17 +1864,37 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3583, + "end": 3619 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3645, + "end": 3654 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3674, + "end": 3711 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -3028,15 +3195,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 3570, + "offset_body": 3713, + "offset_end": 5493 } }, { "InlineBinary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -3054,8 +3221,40 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5548, + "end": 5583 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5609, + "end": 5618 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5638, + "end": 5674 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4383,7 +4582,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 5535, + "offset_body": 5676, + "offset_end": 7492 } } ], diff --git a/tests/legacy/045.txt b/tests/legacy/045.txt index 2e0991f..987f000 100644 --- a/tests/legacy/045.txt +++ b/tests/legacy/045.txt @@ -43,27 +43,19 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.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 } }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-891160829-958746372=:8452" - } - } - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com" - }, "to": { "AddressList": [ { @@ -79,20 +71,93 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= "subject": { "Text": "Die Hasen und die Frösche" }, - "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" + }, + "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 ], @@ -116,13 +181,40 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 691, + "end": 722 + } + ] + ], "is_encoding_problem": false, - "body": "\n" + "body": "\n", + "offset_header": 678, + "offset_body": 724, + "offset_end": 724 } }, { "Text": { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1", + "name": "HasenundFrösche.txt" + } + } + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -132,28 +224,65 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= } } }, - "content_id": { - "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "name": "HasenundFrösche.txt", - "charset": "iso-8859-1" - } - } + "content_transfer_encoding": { + "Text": "BASE64" }, "content_description": { "Text": "Short story in German" - }, - "content_transfer_encoding": { - "Text": "BASE64" } }, + "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": "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" + "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 } } ], @@ -168,6 +297,6 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= ] }, "offset_header": 0, - "offset_body": 419, + "offset_body": 417, "offset_end": 2168 } \ No newline at end of file diff --git a/tests/legacy/046.txt b/tests/legacy/046.txt index 991d750..b4e327d 100644 --- a/tests/legacy/046.txt +++ b/tests/legacy/046.txt @@ -33,9 +33,21 @@ 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, @@ -54,20 +66,100 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "name": "Jürgen Schmürgen", "address": "schmuergen@example.com" } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 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": 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 ], @@ -79,9 +171,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -90,10 +179,36 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 373, + "end": 406 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 432, + "end": 451 + } + ] + ], "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" + "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 } } ], diff --git a/tests/legacy/047.txt b/tests/legacy/047.txt index e111dec..da194e1 100644 --- a/tests/legacy/047.txt +++ b/tests/legacy/047.txt @@ -61,6 +61,9 @@ 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", @@ -76,15 +79,12 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= } } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, "message_id": { "Text": "392367BC.3D075C95@example.com" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -98,13 +98,96 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_minute": 0 } }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "mime_version": { - "Text": "1.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 ], @@ -118,6 +201,9 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -126,31 +212,51 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 508 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 534, + "end": 541 + } + ] + ], "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." + "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 } }, { "Text": { "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" + "charset": "iso-8859-1", + "name": "HasenundFrösche.txt" } } }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -161,8 +267,40 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= } } }, + "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": "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" + "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 } } ], diff --git a/tests/legacy/048.txt b/tests/legacy/048.txt index 4dea8a7..23ea212 100644 --- a/tests/legacy/048.txt +++ b/tests/legacy/048.txt @@ -159,6 +159,12 @@ end "mime_version": { "Text": "1.0" }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -174,6 +180,9 @@ end "address": "dwsauder@example.com" } }, + "message_id": { + "Text": "3923670C.67D83A99@example.com" + }, "date": { "DateTime": { "year": 2000, @@ -187,19 +196,93 @@ end "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, "subject": { "Text": "Test message from Netscape Communicator 4.7" - }, - "message_id": { - "Text": "3923670C.67D83A99@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, @@ -234,16 +317,36 @@ end "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 477, + "end": 508 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 534, + "end": 541 + } + ] + ], "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." + "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 } }, { "InlineBinary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -253,6 +356,9 @@ end } } }, + "content_transfer_encoding": { + "Text": "x-uuencode" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -263,6 +369,35 @@ end } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1365, + "end": 1399 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1425, + "end": 1438 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 1458, + "end": 1493 + } + ] + ], "is_encoding_problem": false, "body": [ 98, @@ -2332,15 +2467,15 @@ end 100, 13, 10 - ] + ], + "offset_header": 1352, + "offset_body": 1495, + "offset_end": 3562 } }, { "InlineBinary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -2350,6 +2485,9 @@ end } } }, + "content_transfer_encoding": { + "Text": "x-uuencode" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -2360,6 +2498,35 @@ end } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3617, + "end": 3653 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 3679, + "end": 3692 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 3712, + "end": 3749 + } + ] + ], "is_encoding_problem": false, "body": [ 98, @@ -4211,7 +4378,10 @@ end 100, 13, 10 - ] + ], + "offset_header": 3604, + "offset_body": 3751, + "offset_end": 5600 } }, { @@ -4226,9 +4396,6 @@ end } } }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -4237,8 +4404,40 @@ end "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "x-uuencode" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5655, + "end": 5690 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 5716, + "end": 5729 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 5749, + "end": 5785 + } + ] + ], "is_encoding_problem": false, "body": [ 98, @@ -6128,7 +6327,10 @@ end 100, 13, 10 - ] + ], + "offset_header": 5642, + "offset_body": 5787, + "offset_end": 7674 } } ], diff --git a/tests/legacy/049.txt b/tests/legacy/049.txt index 31841b2..0580258 100644 --- a/tests/legacy/049.txt +++ b/tests/legacy/049.txt @@ -144,9 +144,6 @@ end "address": "jblow@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" - }, "subject": { "Text": "Test message from Microsoft Outlook 00" }, @@ -162,8 +159,103 @@ end "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 ], @@ -183,8 +275,12 @@ end } } }, + "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" + "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 } } ], @@ -192,6 +288,6 @@ end "Part": 0 }, "offset_header": 0, - "offset_body": 420, + "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 209661a..98519a0 100644 --- a/tests/legacy/050.txt +++ b/tests/legacy/050.txt @@ -110,37 +110,37 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } }, "content_type": { "ContentType": { "c_type": "multipart", "c_subtype": "related", "attributes": { - "type": "text/html", - "boundary": "=====================_715546120==_.REL" + "boundary": "=====================_715546120==_.REL", + "type": "text/html" } } }, - "message_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" - }, "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" }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -155,6 +155,98 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "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 ], @@ -182,18 +274,44 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 565, + "end": 599 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 625, + "end": 644 + } + ] + ], "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa658b6.png" + } + } }, "content_type": { "ContentType": { @@ -204,16 +322,51 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "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 + } + ], + [ + { + "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": [ 137, @@ -1541,15 +1694,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 1929, + "offset_body": 2132, + "offset_end": 3946 } }, { "Binary": { "headers_rfc": { - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1559,6 +1712,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -1568,10 +1724,48 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 4003, + "end": 4036 + } + ], + [ + { + "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": [ 137, @@ -3027,7 +3221,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 66, 96, 130 - ] + ], + "offset_header": 3990, + "offset_body": 4193, + "offset_end": 6183 } } ], diff --git a/tests/legacy/051.txt b/tests/legacy/051.txt index ae363b4..5c9f856 100644 --- a/tests/legacy/051.txt +++ b/tests/legacy/051.txt @@ -162,12 +162,24 @@ 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" }, @@ -180,18 +192,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "date": { "DateTime": { "year": 2000, @@ -206,6 +206,98 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "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 ], @@ -227,20 +319,31 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715515186==_.REL", - "type": "text/plain" + "type": "text/plain", + "boundary": "=====================_715515186==_.REL" } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 535, + "end": 629 + } + ] + ], + "offset_header": 522, + "offset_body": 631, + "offset_end": 5945 } }, { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -249,24 +352,41 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } + }, + "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" + "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 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa5e03a.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -276,6 +396,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa5e03a.png" + } + } + }, "content_id": { "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" }, @@ -283,6 +412,44 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1658, + "end": 1691 + } + ], + [ + { + "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": [ 137, @@ -1610,20 +1777,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 1645, + "offset_body": 1848, + "offset_end": 3662 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa5e044.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_type": { "ContentType": { @@ -1634,13 +1798,57 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "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_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 3719, + "end": 3752 + } + ], + [ + { + "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": [ 137, @@ -3096,12 +3304,24 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 3706, + "offset_body": 3909, + "offset_end": 5899 } }, { "Binary": { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -3113,17 +3333,37 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 5998, + "end": 6031 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 6057, + "end": 6066 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 6086, + "end": 6124 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -4451,24 +4691,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 5985, + "offset_body": 6126, + "offset_end": 7940 } }, { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -4477,8 +4708,49 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 7993, + "end": 8027 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 8053, + "end": 8062 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 8082, + "end": 8121 + } + ] + ], "is_encoding_problem": false, "body": [ 137, @@ -5779,7 +6051,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 66, 96, 130 - ] + ], + "offset_header": 7980, + "offset_body": 8123, + "offset_end": 9899 } } ], diff --git a/tests/legacy/052.txt b/tests/legacy/052.txt index 5bb5978..c8b5b76 100644 --- a/tests/legacy/052.txt +++ b/tests/legacy/052.txt @@ -28,24 +28,12 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, "to": { "Address": { "name": "Heinz M�ller", "address": "mueller@example.com" } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -58,8 +46,112 @@ welche also wohl noch ungl "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 ], @@ -79,8 +171,12 @@ welche also wohl noch ungl } } }, + "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" + "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 } } ], diff --git a/tests/legacy/053.txt b/tests/legacy/053.txt index 4708ea6..2d99bb5 100644 --- a/tests/legacy/053.txt +++ b/tests/legacy/053.txt @@ -39,14 +39,8 @@ als wir."=20 "address": "mueller@example.com" } }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, "date": { "DateTime": { @@ -64,10 +58,135 @@ als wir."=20 "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" }, - "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" + } } }, + "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 ], @@ -79,9 +198,6 @@ als wir."=20 { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -90,10 +206,36 @@ als wir."=20 "charset": "utf-8" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 309, + "end": 341 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 367, + "end": 386 + } + ] + ], "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" + "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 } } ], diff --git a/tests/malformed/000.txt b/tests/malformed/000.txt index cb5f5d2..aa4890b 100644 --- a/tests/malformed/000.txt +++ b/tests/malformed/000.txt @@ -21,6 +21,17 @@ Content-Type: text/html } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 47 + } + ] + ], "html_body": [], "text_body": [], "attachments": [], diff --git a/tests/malformed/001.txt b/tests/malformed/001.txt index 8797ad7..c43a6ec 100644 --- a/tests/malformed/001.txt +++ b/tests/malformed/001.txt @@ -21,6 +21,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 45 + } + ] + ], "html_body": [ 1 ], @@ -41,7 +52,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 64, + "end": 95 + } + ] + ], + "offset_header": 51, + "offset_body": 96, + "offset_end": 132 } }, { @@ -55,8 +80,12 @@ Content-Type: text/plain } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "Content-Type: text/plain\n" + "body": "Content-Type: text/plain\n", + "offset_header": 99, + "offset_body": 101, + "offset_end": 126 } } ], diff --git a/tests/malformed/002.txt b/tests/malformed/002.txt index 9265d2f..c180148 100644 --- a/tests/malformed/002.txt +++ b/tests/malformed/002.txt @@ -4,6 +4,17 @@ body ---- EXPECTED STRUCTURE ----{ "headers_rfc": {}, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 45 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -23,8 +34,22 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 45 + } + ] + ], "is_encoding_problem": false, - "body": "body\n" + "body": "body\n", + "offset_header": 0, + "offset_body": 46, + "offset_end": 51 } } ], diff --git a/tests/malformed/003.txt b/tests/malformed/003.txt index 9935b8b..be84c54 100644 --- a/tests/malformed/003.txt +++ b/tests/malformed/003.txt @@ -20,6 +20,17 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -38,7 +49,21 @@ body } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 93 + } + ] + ], + "offset_header": 49, + "offset_body": 94, + "offset_end": 129 } }, { @@ -52,8 +77,22 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 111, + "end": 123 + } + ] + ], "is_encoding_problem": true, - "body": "body\n" + "body": "body\n", + "offset_header": 98, + "offset_body": 124, + "offset_end": 125 } } ], diff --git a/tests/malformed/004.txt b/tests/malformed/004.txt index 4cb1a3a..9c6baf5 100644 --- a/tests/malformed/004.txt +++ b/tests/malformed/004.txt @@ -20,6 +20,17 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -37,8 +48,12 @@ body } } }, + "headers_raw": [], "is_encoding_problem": true, - "body": "Content-Type: multipart/mixed; boundary=\"a\"\n\n--ac\nContent-Type: text/plain\n\nbody\n" + "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 } } ], diff --git a/tests/malformed/005.txt b/tests/malformed/005.txt index f00e4a9..deafbc0 100644 --- a/tests/malformed/005.txt +++ b/tests/malformed/005.txt @@ -24,6 +24,17 @@ body2 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 46 + } + ] + ], "html_body": [ 1 ], @@ -44,7 +55,21 @@ body2 } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 66, + "end": 101 + } + ] + ], + "offset_header": 53, + "offset_body": 102, + "offset_end": 151 } }, { @@ -58,8 +83,22 @@ body2 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 123, + "end": 135 + } + ] + ], "is_encoding_problem": false, - "body": "body" + "body": "body", + "offset_header": 110, + "offset_body": 136, + "offset_end": 140 } } ], diff --git a/tests/malformed/006.txt b/tests/malformed/006.txt index db7d87c..56d0b44 100644 --- a/tests/malformed/006.txt +++ b/tests/malformed/006.txt @@ -20,6 +20,17 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -38,7 +49,21 @@ body } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 94 + } + ] + ], + "offset_header": 49, + "offset_body": 95, + "offset_end": 131 } }, { @@ -52,8 +77,22 @@ body } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 113, + "end": 125 + } + ] + ], "is_encoding_problem": true, - "body": "body\n" + "body": "body\n", + "offset_header": 100, + "offset_body": 126, + "offset_end": 126 } } ], diff --git a/tests/malformed/007.txt b/tests/malformed/007.txt index 18f2538..fc10166 100644 --- a/tests/malformed/007.txt +++ b/tests/malformed/007.txt @@ -22,6 +22,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -31,6 +42,9 @@ Content-Type: text/plain { "Multipart": { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -39,11 +53,31 @@ Content-Type: text/plain "boundary": "ab" } } - }, - "mime_version": { - "Text": "1.0" } - } + }, + "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 } }, { @@ -57,8 +91,12 @@ Content-Type: text/plain } } }, + "headers_raw": [], "is_encoding_problem": true, - "body": "--a--\n\n" + "body": "--a--\n\n", + "offset_header": 147, + "offset_body": 150, + "offset_end": 152 } } ], diff --git a/tests/malformed/008.txt b/tests/malformed/008.txt index 723d3ed..c94c087 100644 --- a/tests/malformed/008.txt +++ b/tests/malformed/008.txt @@ -24,6 +24,17 @@ body2 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 45 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -42,7 +53,21 @@ body2 } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 64, + "end": 95 + } + ] + ], + "offset_header": 51, + "offset_body": 96, + "offset_end": 167 } }, { @@ -56,8 +81,22 @@ body2 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 113, + "end": 125 + } + ] + ], "is_encoding_problem": true, - "body": "body\n--ab\nContent-Type: text/html\n\nbody2\n" + "body": "body\n--ab\nContent-Type: text/html\n\nbody2\n", + "offset_header": 100, + "offset_body": 126, + "offset_end": 163 } } ], diff --git a/tests/malformed/009.txt b/tests/malformed/009.txt index 72aafcb..f7adb57 100644 --- a/tests/malformed/009.txt +++ b/tests/malformed/009.txt @@ -28,6 +28,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [ 1 ], @@ -50,7 +61,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 93 + } + ] + ], + "offset_header": 49, + "offset_body": 94, + "offset_end": 193 } }, { @@ -64,8 +89,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 111, + "end": 123 + } + ] + ], "is_encoding_problem": false, - "body": "1" + "body": "1", + "offset_header": 98, + "offset_body": 124, + "offset_end": 125 } }, { @@ -79,8 +118,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 143, + "end": 155 + } + ] + ], "is_encoding_problem": true, - "body": "22\n--1\nContent-Type: text/plain\n\n333\n" + "body": "22\n--1\nContent-Type: text/plain\n\n333\n", + "offset_header": 130, + "offset_body": 156, + "offset_end": 189 } } ], diff --git a/tests/malformed/010.txt b/tests/malformed/010.txt index 92c43a0..53f1bdf 100644 --- a/tests/malformed/010.txt +++ b/tests/malformed/010.txt @@ -16,6 +16,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 29 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -33,6 +44,7 @@ Content-Type: text/plain } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": { @@ -44,6 +56,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 43, + "end": 59 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -61,9 +84,21 @@ Content-Type: text/plain } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": {}, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 73, + "end": 85 + } + ] + ], "html_body": [ 0 ], @@ -83,8 +118,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 73, + "end": 85 + } + ] + ], "is_encoding_problem": false, - "body": "1\n" + "body": "1\n", + "offset_header": 60, + "offset_body": 86, + "offset_end": 88 } } ], @@ -94,7 +143,10 @@ Content-Type: text/plain "offset_header": 60, "offset_body": 86, "offset_end": 88 - } + }, + "offset_header": 30, + "offset_body": 60, + "offset_end": 88 } } ], @@ -104,7 +156,10 @@ Content-Type: text/plain "offset_header": 30, "offset_body": 60, "offset_end": 88 - } + }, + "offset_header": 0, + "offset_body": 30, + "offset_end": 88 } } ], diff --git a/tests/malformed/011.txt b/tests/malformed/011.txt index 72aafcb..f7adb57 100644 --- a/tests/malformed/011.txt +++ b/tests/malformed/011.txt @@ -28,6 +28,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [ 1 ], @@ -50,7 +61,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 93 + } + ] + ], + "offset_header": 49, + "offset_body": 94, + "offset_end": 193 } }, { @@ -64,8 +89,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 111, + "end": 123 + } + ] + ], "is_encoding_problem": false, - "body": "1" + "body": "1", + "offset_header": 98, + "offset_body": 124, + "offset_end": 125 } }, { @@ -79,8 +118,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 143, + "end": 155 + } + ] + ], "is_encoding_problem": true, - "body": "22\n--1\nContent-Type: text/plain\n\n333\n" + "body": "22\n--1\nContent-Type: text/plain\n\n333\n", + "offset_header": 130, + "offset_body": 156, + "offset_end": 189 } } ], diff --git a/tests/malformed/012.txt b/tests/malformed/012.txt index bbce9e2..25d821b 100644 --- a/tests/malformed/012.txt +++ b/tests/malformed/012.txt @@ -34,6 +34,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -53,7 +64,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 93 + } + ] + ], + "offset_header": 49, + "offset_body": 94, + "offset_end": 283 } }, { @@ -67,9 +92,31 @@ Content-Type: text/plain } } }, + "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 + } + ] + ], "html_body": [ 0 ], @@ -89,8 +136,22 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 141, + "end": 153 + } + ] + ], "is_encoding_problem": false, - "body": "1" + "body": "1", + "offset_header": 128, + "offset_body": 154, + "offset_end": 155 } } ], @@ -99,8 +160,11 @@ Content-Type: text/plain }, "offset_header": 128, "offset_body": 154, - "offset_end": 160 - } + "offset_end": 155 + }, + "offset_header": 98, + "offset_body": 128, + "offset_end": 155 } }, { @@ -114,9 +178,31 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 173, + "end": 189 + } + ] + ], "is_encoding_problem": false, "body": { "headers_rfc": {}, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 203, + "end": 215 + } + ] + ], "html_body": [], "text_body": [], "attachments": [ @@ -134,8 +220,22 @@ Content-Type: text/plain } } }, + "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" + "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 } } ], @@ -144,8 +244,11 @@ Content-Type: text/plain }, "offset_header": 190, "offset_body": 216, - "offset_end": 283 - } + "offset_end": 279 + }, + "offset_header": 160, + "offset_body": 190, + "offset_end": 279 } } ], diff --git a/tests/malformed/013.txt b/tests/malformed/013.txt index 1723ecb..b59a46a 100644 --- a/tests/malformed/013.txt +++ b/tests/malformed/013.txt @@ -33,6 +33,9 @@ hello, world ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -41,11 +44,28 @@ hello, world "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, 2, @@ -71,26 +91,63 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 80, + "end": 92 + } + ] + ], "is_encoding_problem": false, - "body": "hello, world" + "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" - }, - "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 + } + ] + ], + "offset_header": 110, + "offset_body": 173, + "offset_end": 436 } }, { @@ -104,26 +161,63 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 190, + "end": 202 + } + ] + ], "is_encoding_problem": false, - "body": "hello, world" + "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" - }, - "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 + } + ] + ], + "offset_header": 220, + "offset_body": 283, + "offset_end": 436 } }, { @@ -137,8 +231,22 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 300, + "end": 312 + } + ] + ], "is_encoding_problem": false, - "body": "hello, world" + "body": "hello, world", + "offset_header": 287, + "offset_body": 313, + "offset_end": 325 } }, { @@ -153,7 +261,30 @@ hello, world } } } - } + }, + "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 } }, { @@ -167,19 +298,60 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 406, + "end": 418 + } + ] + ], "is_encoding_problem": false, - "body": "hello, world" + "body": "hello, world", + "offset_header": 393, + "offset_body": 419, + "offset_end": 431 } } ], "structure": { - "MultiPart": [ - 5, - [ - { - "Part": 6 - } - ] + "List": [ + { + "Part": 0 + }, + { + "MultiPart": [ + 1, + [ + { + "Part": 2 + }, + { + "MultiPart": [ + 3, + [ + { + "Part": 4 + }, + { + "MultiPart": [ + 5, + [ + { + "Part": 6 + } + ] + ] + } + ] + ] + } + ] + ] + } ] }, "offset_header": 0, diff --git a/tests/malformed/014.txt b/tests/malformed/014.txt index 5b54c3c..54071f1 100644 --- a/tests/malformed/014.txt +++ b/tests/malformed/014.txt @@ -18,6 +18,17 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [ 0 ], @@ -37,8 +48,22 @@ hello, world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 62, + "end": 74 + } + ] + ], "is_encoding_problem": false, - "body": "hello, world" + "body": "hello, world", + "offset_header": 49, + "offset_body": 75, + "offset_end": 87 } } ], diff --git a/tests/malformed/015.txt b/tests/malformed/015.txt index 73f8e51..48421e3 100644 --- a/tests/malformed/015.txt +++ b/tests/malformed/015.txt @@ -26,22 +26,8 @@ invalid ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "return_path": { - "Text": "test@example.org" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "signed", - "attributes": { - "protocol": "application/pgp-signature", - "boundary": "=-GNQXLhuj24Pl1aCkk4/d", - "micalg": "pgp-sha1" - } - } + "subject": { + "Text": "Hello world" }, "message_id": { "Text": "1.2.3.4@example" @@ -52,15 +38,23 @@ invalid "address": "test2@example.org" } }, - "subject": { - "Text": "Hello world" - }, - "from": { - "Address": { - "name": "Test User", - "address": "test@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, @@ -73,8 +67,88 @@ invalid "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 ], @@ -88,19 +162,42 @@ invalid { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 373, + "end": 385 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 411, + "end": 429 + } + ] + ], "is_encoding_problem": false, - "body": "There was a day \na happy day\n" + "body": "There was a day \na happy day\n", + "offset_header": 360, + "offset_body": 430, + "offset_end": 463 } }, { @@ -116,6 +213,17 @@ invalid } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 502, + "end": 549 + } + ] + ], "is_encoding_problem": false, "body": [ 105, @@ -126,7 +234,10 @@ invalid 105, 100, 10 - ] + ], + "offset_header": 489, + "offset_body": 550, + "offset_end": 558 } } ], diff --git a/tests/malformed/016.txt b/tests/malformed/016.txt index e9beb4c..52f344b 100644 --- a/tests/malformed/016.txt +++ b/tests/malformed/016.txt @@ -35,6 +35,17 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 125 + } + ] + ], "html_body": [ 2 ], @@ -57,7 +68,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 224, + "end": 335 + } + ] + ], + "offset_header": 211, + "offset_body": 336, + "offset_end": 997 } }, { @@ -72,7 +97,21 @@ Content-Type: text/plain } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 433, + "end": 543 + } + ] + ], + "offset_header": 420, + "offset_body": 544, + "offset_end": 997 } }, { @@ -86,8 +125,22 @@ Content-Type: text/plain } } }, + "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" + "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 } }, { @@ -101,20 +154,41 @@ Content-Type: text/plain } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 979, + "end": 991 + } + ] + ], "is_encoding_problem": true, - "body": "4444\n" + "body": "4444\n", + "offset_header": 966, + "offset_body": 992, + "offset_end": 914 } } ], "structure": { "MultiPart": [ - 1, + 0, [ { - "Part": 2 - }, - { - "Part": 3 + "MultiPart": [ + 1, + [ + { + "Part": 2 + }, + { + "Part": 3 + } + ] + ] } ] ] diff --git a/tests/rfc/000.txt b/tests/rfc/000.txt index 71b3b80..70bdb21 100644 --- a/tests/rfc/000.txt +++ b/tests/rfc/000.txt @@ -73,24 +73,12 @@ Content-Transfer-Encoding: Quoted-printable ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@nsb.fv.com" - } - }, - "mime_version": { - "Text": "1.0" - }, "to": { "Address": { "name": "Ned Freed", "address": "ned@innosoft.com" } }, - "subject": { - "Text": "A multipart example" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -100,6 +88,18 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@nsb.fv.com" + } + }, + "subject": { + "Text": "A multipart example" + }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 1994, @@ -114,6 +114,62 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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 @@ -140,8 +196,12 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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" + "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 } }, { @@ -157,8 +217,22 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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" + "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 } }, { @@ -173,7 +247,21 @@ Content-Transfer-Encoding: Quoted-printable } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1003, + "end": 1051 + } + ] + ], + "offset_header": 990, + "offset_body": 1052, + "offset_end": 1366 } }, { @@ -190,8 +278,31 @@ Content-Transfer-Encoding: Quoted-printable "Text": "base64" } }, + "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" + "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 } }, { @@ -208,8 +319,31 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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" + "body": "... base64-encoded image data goes here ...\n", + "offset_header": 1239, + "offset_body": 1299, + "offset_end": 1343 } }, { @@ -223,8 +357,22 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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" + "body": "This is enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n", + "offset_header": 1387, + "offset_body": 1416, + "offset_end": 1556 } }, { @@ -238,18 +386,29 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1590, + "end": 1606 + } + ] + ], "is_encoding_problem": false, "body": { "headers_rfc": { - "subject": { - "Text": "(subject in US-ASCII)" - }, "to": { "Address": { "name": "address in US-ASCII", "address": null } }, + "subject": { + "Text": "(subject in US-ASCII)" + }, "from": { "Address": { "name": "mailbox in US-ASCII", @@ -257,6 +416,53 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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 + } + ] + ], "html_body": [ 0 ], @@ -281,8 +487,31 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "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" + "body": "... Additional text in ISO-8859-1 goes here ...\n", + "offset_header": 1607, + "offset_body": 1782, + "offset_end": 1830 } } ], @@ -291,8 +520,11 @@ Content-Transfer-Encoding: Quoted-printable }, "offset_header": 1607, "offset_body": 1782, - "offset_end": 1850 - } + "offset_end": 1830 + }, + "offset_header": 1577, + "offset_body": 1607, + "offset_end": 1830 } } ], diff --git a/tests/rfc/001.txt b/tests/rfc/001.txt index 83f2022..2b41f71 100644 --- a/tests/rfc/001.txt +++ b/tests/rfc/001.txt @@ -41,6 +41,15 @@ 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" }, @@ -53,28 +62,93 @@ get RFC-MIME.DOC } } }, + "content_id": { + "Text": "id001@guppylake.bellcore.com" + }, + "subject": { + "Text": "whatever" + }, "to": { "Address": { "name": "Someone", "address": null } - }, - "subject": { - "Text": "whatever" - }, - "content_id": { - "Text": "id001@guppylake.bellcore.com" - }, - "from": { - "Address": { - "name": "Whomever", - "address": null - } - }, - "mime_version": { - "Text": "1.0" } }, + "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": [ @@ -91,116 +165,27 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "mode": "image", - "site": "thumper.bellcore.com", "access-type": "ANON-FTP", - "directory": "pub", + "mode": "image", + "name": "BodyFormats.ps", "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "name": "BodyFormats.ps" - } - } - } - }, - "is_encoding_problem": false, - "body": [ - 67, - 111, - 110, - 116, - 101, - 110, - 116, - 45, - 116, - 121, - 112, - 101, - 58, - 32, - 97, - 112, - 112, - 108, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 47, - 112, - 111, - 115, - 116, - 115, - 99, - 114, - 105, - 112, - 116, - 10, - 67, - 111, - 110, - 116, - 101, - 110, - 116, - 45, - 73, - 68, - 58, - 32, - 60, - 105, - 100, - 52, - 50, - 64, - 103, - 117, - 112, - 112, - 121, - 108, - 97, - 107, - 101, - 46, - 98, - 101, - 108, - 108, - 99, - 111, - 114, - 101, - 46, - 99, - 111, - 109, - 62, - 10 - ] - } - }, - { - "Binary": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { "site": "thumper.bellcore.com", - "access-type": "local-file", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "name": "/u/nsb/writing/rfcs/RFC-MIME.ps" + "directory": "pub" } } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 216, + "end": 432 + } + ] + ], "is_encoding_problem": false, "body": [ 67, @@ -282,7 +267,10 @@ get RFC-MIME.DOC 109, 62, 10 - ] + ], + "offset_header": 203, + "offset_body": 433, + "offset_end": 512 } }, { @@ -293,13 +281,138 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "access-type": "mail-server", "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "server": "listserv@bogus.bitnet" + "access-type": "local-file", + "name": "/u/nsb/writing/rfcs/RFC-MIME.ps", + "site": "thumper.bellcore.com" } } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 531, + "end": 735 + } + ] + ], + "is_encoding_problem": false, + "body": [ + 67, + 111, + 110, + 116, + 101, + 110, + 116, + 45, + 116, + 121, + 112, + 101, + 58, + 32, + 97, + 112, + 112, + 108, + 105, + 99, + 97, + 116, + 105, + 111, + 110, + 47, + 112, + 111, + 115, + 116, + 115, + 99, + 114, + 105, + 112, + 116, + 10, + 67, + 111, + 110, + 116, + 101, + 110, + 116, + 45, + 73, + 68, + 58, + 32, + 60, + 105, + 100, + 52, + 50, + 64, + 103, + 117, + 112, + 112, + 121, + 108, + 97, + 107, + 101, + 46, + 98, + 101, + 108, + 108, + 99, + 111, + 114, + 101, + 46, + 99, + 111, + 109, + 62, + 10 + ], + "offset_header": 518, + "offset_body": 736, + "offset_end": 815 + } + }, + { + "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_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 834, + "end": 1001 + } + ] + ], "is_encoding_problem": false, "body": [ 67, @@ -399,7 +512,10 @@ get RFC-MIME.DOC 79, 67, 10 - ] + ], + "offset_header": 821, + "offset_body": 1002, + "offset_end": 1099 } } ], diff --git a/tests/rfc/002.txt b/tests/rfc/002.txt index 84a2418..fc83684 100644 --- a/tests/rfc/002.txt +++ b/tests/rfc/002.txt @@ -73,18 +73,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Al Gore", - "address": "vice-president@whitehouse.gov" - } - }, - "to": { - "Address": { - "name": "White House Transportation Coordinator", - "address": "transport@whitehouse.gov" - } - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -94,10 +82,60 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz } } }, + "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 ], @@ -111,9 +149,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -122,18 +157,41 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 370, + "end": 400 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 426, + "end": 432 + } + ] + ], "is_encoding_problem": false, - "body": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl" + "body": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl", + "offset_header": 357, + "offset_body": 433, + "offset_end": 494 } }, { "Message": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -147,17 +205,80 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "c_subtype": "rfc822", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, + "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, @@ -171,44 +292,105 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "tz_minute": 0 } }, - "message_id": { - "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" - }, - "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" - } - ] - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "DC8------------DC8638F443D87A7F0726DEF7" - } - } - }, "from": { "Address": { "name": "Bill Clinton", "address": "president@whitehouse.gov" } - }, - "to": { - "Address": { - "name": "A1 Gore (The Enforcer)", - "address": "vice-president@whitehouse.gov" - } - }, - "return_path": { - "Text": "president@whitehouse.gov" } }, + "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 + } + ] + ], "html_body": [ 0, 1 @@ -237,13 +419,39 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 1562, + "end": 1592 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 1618, + "end": 1624 + } + ] + ], "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" + "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 } }, { "InlineBinary": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -261,11 +469,37 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "name": "map_of_Argentina.gif" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 2036, + "end": 2076 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 2102, + "end": 2110 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 2130, + "end": 2171 + } + ] + ], "is_encoding_problem": false, "body": [ 71, @@ -556,7 +790,10 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz 0, 0, 59 - ] + ], + "offset_header": 2023, + "offset_body": 2172, + "offset_end": 2561 } } ], @@ -572,8 +809,11 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz }, "offset_header": 627, "offset_body": 1462, - "offset_end": 2607 - } + "offset_end": 2606 + }, + "offset_header": 537, + "offset_body": 627, + "offset_end": 2606 } } ], diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index 341b92f..c485282 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -25,12 +25,30 @@ Content-Type: application/x-whatever ---- 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, @@ -46,24 +64,6 @@ Content-Type: application/x-whatever }, "subject": { "Text": "Formatted text mail" - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary42" - } - } } }, "headers_raw": [ diff --git a/tests/rfc/004.txt b/tests/rfc/004.txt index 595623f..7d64c72 100644 --- a/tests/rfc/004.txt +++ b/tests/rfc/004.txt @@ -39,6 +39,15 @@ Subject: my different opinion "mime_version": { "Text": "1.0" }, + "from": { + "Address": { + "name": "Moderator-Address", + "address": null + } + }, + "subject": { + "Text": "Internet Digest, volume 42" + }, "date": { "DateTime": { "year": 1994, @@ -61,15 +70,6 @@ Subject: my different opinion } } }, - "subject": { - "Text": "Internet Digest, volume 42" - }, - "from": { - "Address": { - "name": "Moderator-Address", - "address": null - } - }, "to": { "Address": { "name": "Recipient-List", @@ -77,6 +77,62 @@ Subject: my different opinion } } }, + "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 ], @@ -99,8 +155,12 @@ Subject: my different opinion } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "...Introductory text or table of contents...\n" + "body": "...Introductory text or table of contents...\n", + "offset_header": 240, + "offset_body": 241, + "offset_end": 286 } }, { @@ -115,7 +175,21 @@ Subject: my different opinion } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 326, + "end": 391 + } + ] + ], + "offset_header": 313, + "offset_body": 392, + "offset_end": 698 } }, { @@ -129,15 +203,10 @@ Subject: my different opinion } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": { - "from": { - "Address": { - "name": "someone-else", - "address": null - } - }, "date": { "DateTime": { "year": 1993, @@ -153,8 +222,43 @@ Subject: my different opinion }, "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 ], @@ -174,8 +278,12 @@ Subject: my different opinion } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "...body goes here ...\n" + "body": "...body goes here ...\n", + "offset_header": 418, + "offset_body": 496, + "offset_end": 518 } } ], @@ -184,8 +292,11 @@ Subject: my different opinion }, "offset_header": 418, "offset_body": 496, - "offset_end": 545 - } + "offset_end": 518 + }, + "offset_header": 417, + "offset_body": 418, + "offset_end": 518 } }, { @@ -199,9 +310,19 @@ Subject: my different opinion } } }, + "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, @@ -214,17 +335,37 @@ Subject: my different opinion "tz_hour": 5, "tz_minute": 0 } - }, - "subject": { - "Text": "my different opinion" - }, - "from": { - "Address": { - "name": "someone-else-again", - "address": null - } } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 550, + "end": 570 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 575, + "end": 608 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 616, + "end": 638 + } + ] + ], "html_body": [ 0 ], @@ -244,8 +385,12 @@ Subject: my different opinion } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "... another body goes here ...\n" + "body": "... another body goes here ...\n", + "offset_header": 545, + "offset_body": 639, + "offset_end": 670 } } ], @@ -254,8 +399,11 @@ Subject: my different opinion }, "offset_header": 545, "offset_body": 639, - "offset_end": 695 - } + "offset_end": 670 + }, + "offset_header": 544, + "offset_body": 545, + "offset_end": 670 } } ], diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index 159942e..fe8f26f 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -25,10 +25,20 @@ This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" + "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": { @@ -46,24 +56,14 @@ This is the epilogue. It is also to be ignored. "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 - } - }, "subject": { "Text": "Sample message" }, - "mime_version": { - "Text": "1.0" + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } } }, "headers_raw": [ diff --git a/tests/rfc/006.txt b/tests/rfc/006.txt index bf5b095..0777fed 100644 --- a/tests/rfc/006.txt +++ b/tests/rfc/006.txt @@ -23,6 +23,12 @@ Content-Disposition: inline ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "from": { + "Address": { + "name": null, + "address": "sender@example.com" + } + }, "subject": { "Text": "Multipart Email Example" }, @@ -40,14 +46,46 @@ Content-Disposition: inline "boundary": "boundary-string" } } - }, - "from": { - "Address": { - "name": null, - "address": "sender@example.com" - } } }, + "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 ], @@ -59,13 +97,6 @@ Content-Disposition: inline { "Text": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "text", @@ -75,17 +106,6 @@ Content-Disposition: inline } } }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } - }, - "is_encoding_problem": false, - "body": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n" - } - }, - { - "Html": { - "headers_rfc": { "content_disposition": { "ContentType": { "c_type": "inline", @@ -93,6 +113,49 @@ Content-Disposition: inline "attributes": null } }, + "content_transfer_encoding": { + "Text": "quoted-printable" + } + }, + "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": "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 + } + }, + { + "Html": { + "headers_rfc": { "content_type": { "ContentType": { "c_type": "text", @@ -104,10 +167,49 @@ Content-Disposition: inline }, "content_transfer_encoding": { "Text": "quoted-printable" + }, + "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": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n" + "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 } } ], diff --git a/tests/rfc/007.txt b/tests/rfc/007.txt index 03567ce..642c7ac 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -261,19 +261,19 @@ K { "Text": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } } }, "headers_raw": [ @@ -353,19 +353,19 @@ K { "Text": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } } }, "headers_raw": [ @@ -487,19 +487,19 @@ K { "Binary": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "image", "c_subtype": "jpeg", "attributes": null } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": null + } } }, "headers_raw": [ diff --git a/tests/rfc/008.txt b/tests/rfc/008.txt index 6100e3b..f40891d 100644 --- a/tests/rfc/008.txt +++ b/tests/rfc/008.txt @@ -40,6 +40,17 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 82 + } + ] + ], "html_body": [ 0 ], @@ -66,13 +77,39 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, + "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" + "body": "This is a message with a base64 encoded attached email", + "offset_header": 126, + "offset_body": 199, + "offset_end": 253 } }, { "Message": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "message", @@ -80,9 +117,6 @@ YWFhYWFhYWFhYWFhYS0tDQo= "attributes": null } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -93,6 +127,35 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, + "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": { @@ -102,20 +165,8 @@ YWFhYWFhYWFhYWFhYS0tDQo= "address": "email@example.com" } }, - "content_language": { - "Text": "en-US" - }, - "to": { - "Address": { - "name": "email@example.com", - "address": "email@example.com" - } - }, - "subject": { - "Text": "HTML test" - }, - "message_id": { - "Text": "random-message-id@example.com" + "mime_version": { + "Text": "1.0" }, "date": { "DateTime": { @@ -130,6 +181,9 @@ YWFhYWFhYWFhYWFhYS0tDQo= "tz_minute": 0 } }, + "message_id": { + "Text": "random-message-id@example.com" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -139,10 +193,93 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "HTML test" + }, + "content_language": { + "Text": "en-US" + }, + "to": { + "Address": { + "name": "email@example.com", + "address": "email@example.com" + } } }, + "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 + } + ] + ], "html_body": [ 1 ], @@ -154,9 +291,6 @@ YWFhYWFhYWFhYWFhYS0tDQo= { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -166,10 +300,36 @@ YWFhYWFhYWFhYWFhYS0tDQo= "format": "flowed" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 422, + "end": 465 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 491, + "end": 498 + } + ] + ], "is_encoding_problem": false, - "body": "This is an *HTML* test message" + "body": "This is an *HTML* test message", + "offset_header": 409, + "offset_body": 500, + "offset_end": 530 } }, { @@ -188,8 +348,31 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, + "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" + "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 } } ], @@ -206,7 +389,10 @@ YWFhYWFhYWFhYWFhYS0tDQo= "offset_header": 0, "offset_body": 319, "offset_end": 870 - } + }, + "offset_header": 297, + "offset_body": 424, + "offset_end": 1603 } } ], diff --git a/tests/thirdparty/000.txt b/tests/thirdparty/000.txt index 07083e4..ecc2d3b 100644 --- a/tests/thirdparty/000.txt +++ b/tests/thirdparty/000.txt @@ -33,6 +33,26 @@ ZWg= } } }, + "headers_raw": [ + [ + { + "Rfc": "mime_version" + }, + { + "start": 13, + "end": 19 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 32, + "end": 76 + } + ] + ], "html_body": [ 0, 1 @@ -46,19 +66,42 @@ ZWg= { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 128, + "end": 137 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 150, + "end": 163 + } + ] + ], "is_encoding_problem": false, - "body": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a" + "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 } }, { @@ -75,8 +118,31 @@ ZWg= "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" + "body": "eh", + "offset_header": 400, + "offset_body": 463, + "offset_end": 467 } } ], diff --git a/tests/thirdparty/001.txt b/tests/thirdparty/001.txt index 48a7c45..b1f44f6 100644 --- a/tests/thirdparty/001.txt +++ b/tests/thirdparty/001.txt @@ -38,6 +38,26 @@ hello world "Text": "1.0" } }, + "headers_raw": [ + [ + { + "Rfc": "mime_version" + }, + { + "start": 13, + "end": 19 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 32, + "end": 76 + } + ] + ], "html_body": [ 0, 1, @@ -53,19 +73,42 @@ hello world { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "binary" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "binary" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 128, + "end": 137 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 150, + "end": 163 + } + ] + ], "is_encoding_problem": false, - "body": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=" + "body": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=", + "offset_header": 102, + "offset_body": 165, + "offset_end": 389 } }, { @@ -82,8 +125,31 @@ hello world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 413, + "end": 426 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 452, + "end": 461 + } + ] + ], "is_encoding_problem": false, - "body": "ZWg=" + "body": "ZWg=", + "offset_header": 400, + "offset_body": 463, + "offset_end": 467 } }, { @@ -97,8 +163,22 @@ hello world } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 490, + "end": 503 + } + ] + ], "is_encoding_problem": false, - "body": "hello world\r\n" + "body": "hello world\r\n", + "offset_header": 477, + "offset_body": 505, + "offset_end": 518 } } ], diff --git a/tests/thirdparty/002.txt b/tests/thirdparty/002.txt index 7d36215..bae68f8 100644 --- a/tests/thirdparty/002.txt +++ b/tests/thirdparty/002.txt @@ -30,6 +30,17 @@ Content-Type: text/plain; charset=utf-8 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ] + ], "html_body": [ 0, 1 @@ -58,8 +69,31 @@ Content-Type: text/plain; charset=utf-8 } } }, + "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" + "body": "päivää\n", + "offset_header": 51, + "offset_body": 136, + "offset_end": 158 } }, { @@ -78,8 +112,31 @@ Content-Type: text/plain; charset=utf-8 } } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 191, + "end": 199 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 212, + "end": 239 + } + ] + ], "is_encoding_problem": false, - "body": "yötä vaan.\n�\t�" + "body": "yötä vaan.\n�\t�", + "offset_header": 165, + "offset_body": 240, + "offset_end": 268 } }, { @@ -98,8 +155,31 @@ Content-Type: text/plain; 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": "?garbage" + "body": "?garbage", + "offset_header": 275, + "offset_body": 350, + "offset_end": 358 } } ], diff --git a/tests/thirdparty/003.txt b/tests/thirdparty/003.txt index ef7a341..fe76f7f 100644 --- a/tests/thirdparty/003.txt +++ b/tests/thirdparty/003.txt @@ -48,6 +48,26 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "1.0" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 13, + "end": 44 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 57, + "end": 62 + } + ] + ], "html_body": [ 0, 1, @@ -80,33 +100,82 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "7bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 93, + "end": 104 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 117, + "end": 147 + } + ] + ], "is_encoding_problem": false, - "body": "Move black king to queen's bishop\n" + "body": "Move black king to queen's bishop\n", + "offset_header": 67, + "offset_body": 148, + "offset_end": 182 } }, { "Text": { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } + } + }, "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": 213, + "end": 224 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 237, + "end": 264 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 187, + "offset_body": 265, + "offset_end": 287 } }, { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "8bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -115,13 +184,33 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "8bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 318, + "end": 328 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 341, + "end": 368 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 292, + "offset_body": 369, + "offset_end": 391 } }, { @@ -140,8 +229,31 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== } } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 422, + "end": 455 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 468, + "end": 495 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 396, + "offset_body": 496, + "offset_end": 536 } }, { @@ -160,8 +272,31 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "base64" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 567, + "end": 575 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 588, + "end": 615 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 541, + "offset_body": 616, + "offset_end": 649 } } ], diff --git a/tests/thirdparty/004.txt b/tests/thirdparty/004.txt index cbe4c2b..cca0e5a 100644 --- a/tests/thirdparty/004.txt +++ b/tests/thirdparty/004.txt @@ -41,9 +41,6 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -52,8 +49,31 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "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, @@ -75,6 +95,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers_rfc": { + "content_transfer_encoding": { + "Text": "6bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -83,13 +106,33 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "6bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 93, + "end": 99 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 112, + "end": 139 + } + ] + ], "is_encoding_problem": false, - "body": "Move black king to queen's bishop\n" + "body": "Move black king to queen's bishop\n", + "offset_header": 67, + "offset_body": 140, + "offset_end": 174 } }, { @@ -108,8 +151,31 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "Text": "7bits" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 205, + "end": 218 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 231, + "end": 258 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 179, + "offset_body": 259, + "offset_end": 281 } }, { @@ -128,8 +194,31 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "Text": "8 bit" } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 312, + "end": 319 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 332, + "end": 359 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 286, + "offset_body": 360, + "offset_end": 382 } }, { @@ -148,28 +237,74 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D } } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 413, + "end": 420 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 433, + "end": 460 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 387, + "offset_body": 461, + "offset_end": 483 } }, { "Text": { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } + } + }, "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": 514, + "end": 521 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 534, + "end": 561 + } + ] + ], "is_encoding_problem": false, - "body": "Move ♚ to ♛'s ♝\n" + "body": "Move ♚ to ♛'s ♝\n", + "offset_header": 488, + "offset_body": 562, + "offset_end": 584 } }, { @@ -185,8 +320,31 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D } } }, + "headers_raw": [ + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 615, + "end": 616 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 629, + "end": 656 + } + ] + ], "is_encoding_problem": false, - "body": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n" + "body": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n", + "offset_header": 589, + "offset_body": 657, + "offset_end": 697 } } ], diff --git a/tests/thirdparty/005.txt b/tests/thirdparty/005.txt index d51f835ec1d8b75f49bc837c1e24df0b1e10d226..4f37419a074a345da84e79d78764e343225da13d 100644 GIT binary patch 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 delta 145 zcmextuu*116Z7PHmNS#*v0j_}hL2~moe0-tZ&usM(p;jGw{hD}{>UE;lv_FZ9j7i_ pel`!fJVGy~+~Ubrf`%A+*@WGJX4h?25D{RUyiLqzv%9zsBLJLDGqC^w diff --git a/tests/thirdparty/006.txt b/tests/thirdparty/006.txt index d61cd0d..a98b9f4 100644 --- a/tests/thirdparty/006.txt +++ b/tests/thirdparty/006.txt @@ -39,13 +39,42 @@ Signed by undersigned } } }, - "mime_version": { - "Text": "1.0" - }, "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 ], @@ -70,7 +99,30 @@ Signed by undersigned } } } - } + }, + "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 } }, { @@ -85,7 +137,21 @@ Signed by undersigned } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 226, + "end": 261 + } + ] + ], + "offset_header": 213, + "offset_body": 262, + "offset_end": 497 } }, { @@ -101,26 +167,63 @@ Signed by undersigned } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 279, + "end": 308 + } + ] + ], "is_encoding_problem": false, - "body": "Search me

Don't find me here

\n" + "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" + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } - }, - "content_transfer_encoding": { - "Text": "binary" } }, + "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" + "body": "Search me, and Find me here", + "offset_header": 403, + "offset_body": 463, + "offset_end": 490 } }, { @@ -136,6 +239,17 @@ Signed by undersigned } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 515, + "end": 550 + } + ] + ], "is_encoding_problem": false, "body": [ 83, @@ -159,7 +273,10 @@ Signed by undersigned 110, 101, 100 - ] + ], + "offset_header": 502, + "offset_body": 551, + "offset_end": 572 } } ], diff --git a/tests/thirdparty/007.txt b/tests/thirdparty/007.txt index 15d6f71..6a6702e 100644 --- a/tests/thirdparty/007.txt +++ b/tests/thirdparty/007.txt @@ -34,12 +34,6 @@ Foobar --1-- ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "from": { - "Address": { - "name": "Moderator-Address", - "address": "moderator" - } - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -48,8 +42,34 @@ Foobar "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": [ @@ -69,19 +89,40 @@ Foobar } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": { + "subject": { + "Text": "my opinion" + }, "from": { "Address": { "name": "someone-else", "address": "someone@else" } - }, - "subject": { - "Text": "my opinion" } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 92, + "end": 121 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 129, + "end": 141 + } + ] + ], "html_body": [ 0 ], @@ -101,8 +142,12 @@ Foobar } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "This is my opinion" + "body": "This is my opinion", + "offset_header": 87, + "offset_body": 142, + "offset_end": 160 } } ], @@ -111,8 +156,11 @@ Foobar }, "offset_header": 87, "offset_body": 142, - "offset_end": 166 - } + "offset_end": 160 + }, + "offset_header": 86, + "offset_body": 87, + "offset_end": 160 } }, { @@ -126,19 +174,40 @@ Foobar } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": { + "subject": { + "Text": "i disagree" + }, "from": { "Address": { "name": "another one", "address": "another@one" } - }, - "subject": { - "Text": "i disagree" } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 171, + "end": 198 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 206, + "end": 218 + } + ] + ], "html_body": [ 0 ], @@ -158,8 +227,12 @@ Foobar } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "Not agreeing one bit!" + "body": "Not agreeing one bit!", + "offset_header": 166, + "offset_body": 219, + "offset_end": 240 } } ], @@ -168,8 +241,11 @@ Foobar }, "offset_header": 166, "offset_body": 219, - "offset_end": 246 - } + "offset_end": 240 + }, + "offset_header": 165, + "offset_body": 166, + "offset_end": 240 } }, { @@ -183,9 +259,13 @@ Foobar } } }, + "headers_raw": [], "is_encoding_problem": false, "body": { "headers_rfc": { + "subject": { + "Text": "funny hat" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -200,11 +280,37 @@ Foobar "name": "attachment", "address": "attachment@user" } - }, - "subject": { - "Text": "funny hat" } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 251, + "end": 281 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 289, + "end": 300 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 313, + "end": 342 + } + ] + ], "html_body": [ 0 ], @@ -229,8 +335,31 @@ Foobar "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" + "body": "Lovely attachment for you", + "offset_header": 347, + "offset_body": 407, + "offset_end": 432 } }, { @@ -241,8 +370,8 @@ Foobar "c_type": "application", "c_subtype": "octet-stream", "attributes": { - "name": "test.txt", - "disposition": "attachment" + "disposition": "attachment", + "name": "test.txt" } } }, @@ -250,6 +379,26 @@ Foobar "Text": "binary" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 450, + "end": 517 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 543, + "end": 551 + } + ] + ], "is_encoding_problem": false, "body": [ 70, @@ -258,7 +407,10 @@ Foobar 98, 97, 114 - ] + ], + "offset_header": 437, + "offset_body": 552, + "offset_end": 558 } } ], @@ -274,8 +426,11 @@ Foobar }, "offset_header": 246, "offset_body": 343, - "offset_end": 565 - } + "offset_end": 564 + }, + "offset_header": 245, + "offset_body": 246, + "offset_end": 564 } } ], @@ -293,6 +448,6 @@ Foobar ] }, "offset_header": 0, - "offset_body": 82, + "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 01330eb..f338121 100644 --- a/tests/thirdparty/008.txt +++ b/tests/thirdparty/008.txt @@ -57,6 +57,9 @@ Root MIME epilogue ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -84,11 +87,55 @@ Root MIME epilogue "name": null, "address": "user@domain.org" } - }, - "mime_version": { - "Text": "1.0" } }, + "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 ], @@ -113,8 +160,22 @@ Root MIME epilogue } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 215, + "end": 247 + } + ] + ], "is_encoding_problem": false, - "body": "hello\n" + "body": "hello\n", + "offset_header": 202, + "offset_body": 248, + "offset_end": 254 } }, { @@ -128,9 +189,33 @@ Root MIME epilogue } } }, + "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, @@ -146,23 +231,48 @@ Root MIME epilogue } } }, - "date": { - "DateTime": { - "year": 2012, - "month": 8, - "day": 12, - "hour": 12, - "minute": 34, - "second": 56, - "tz_before_gmt": false, - "tz_hour": 3, - "tz_minute": 0 - } - }, "subject": { "Text": "submsg" } }, + "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 + } + ] + ], "html_body": [ 0, 4 @@ -185,8 +295,22 @@ Root MIME epilogue } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 462, + "end": 473 + } + ] + ], "is_encoding_problem": false, - "body": "

Hello world

\n" + "body": "

Hello world

\n", + "offset_header": 449, + "offset_body": 474, + "offset_end": 493 } }, { @@ -201,7 +325,21 @@ Root MIME epilogue } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 514, + "end": 554 + } + ] + ], + "offset_header": 501, + "offset_body": 555, + "offset_end": 701 } }, { @@ -216,7 +354,21 @@ Root MIME epilogue } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 575, + "end": 615 + } + ] + ], + "offset_header": 562, + "offset_body": 616, + "offset_end": 662 } }, { @@ -230,8 +382,12 @@ Root MIME epilogue } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "sub3 text" + "body": "sub3 text", + "offset_header": 623, + "offset_body": 624, + "offset_end": 633 } }, { @@ -245,8 +401,12 @@ Root MIME epilogue } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "sub3 text2" + "body": "sub3 text2", + "offset_header": 641, + "offset_body": 642, + "offset_end": 652 } }, { @@ -260,8 +420,12 @@ Root MIME epilogue } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "sub2 text2" + "body": "sub2 text2", + "offset_header": 680, + "offset_body": 681, + "offset_end": 691 } } ], @@ -297,8 +461,11 @@ Root MIME epilogue }, "offset_header": 295, "offset_body": 424, - "offset_end": 710 - } + "offset_end": 728 + }, + "offset_header": 265, + "offset_body": 295, + "offset_end": 728 } }, { @@ -312,8 +479,22 @@ Root MIME epilogue } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 752, + "end": 764 + } + ] + ], "is_encoding_problem": false, - "body": "Another part" + "body": "Another part", + "offset_header": 739, + "offset_body": 765, + "offset_end": 777 } } ], diff --git a/tests/thirdparty/009.txt b/tests/thirdparty/009.txt index b3152ce..3a78dda 100644 --- a/tests/thirdparty/009.txt +++ b/tests/thirdparty/009.txt @@ -37,6 +37,35 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= "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 ], @@ -50,19 +79,42 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= { "Text": { "headers_rfc": { - "content_transfer_encoding": { - "Text": "binary" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "binary" } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 96, + "end": 108 + } + ], + [ + { + "Rfc": "content_transfer_encoding" + }, + { + "start": 134, + "end": 142 + } + ] + ], "is_encoding_problem": false, - "body": "Hi, this is the fancy thing I was talking about!" + "body": "Hi, this is the fancy thing I was talking about!", + "offset_header": 83, + "offset_body": 143, + "offset_end": 191 } }, { @@ -73,13 +125,24 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= "c_type": "message", "c_subtype": "partial", "attributes": { + "id": "heks68ewe@example.org", "total": "5", - "number": "1", - "id": "heks68ewe@example.org" + "number": "1" } } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 209, + "end": 273 + } + ] + ], "is_encoding_problem": false, "body": [ 88, @@ -323,7 +386,10 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= 81, 111, 61 - ] + ], + "offset_header": 196, + "offset_body": 274, + "offset_end": 515 } } ], diff --git a/tests/thirdparty/010.txt b/tests/thirdparty/010.txt index 098708f..e6ae8ad 100644 --- a/tests/thirdparty/010.txt +++ b/tests/thirdparty/010.txt @@ -29,6 +29,35 @@ Content-Language: ja "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 ], @@ -40,6 +69,9 @@ Content-Language: ja { "Text": { "headers_rfc": { + "content_language": { + "Text": "ja" + }, "content_transfer_encoding": { "Text": "binary" }, @@ -49,13 +81,42 @@ Content-Language: ja "c_subtype": "plain", "attributes": null } - }, - "content_language": { - "Text": "ja" } }, + "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": "人権の無視及" + "body": "人権の無視及", + "offset_header": 150, + "offset_body": 231, + "offset_end": 249 } } ],