From ac877920520e7897d09c10c5132ccbed993dbbde Mon Sep 17 00:00:00 2001 From: Mauro D Date: Wed, 15 Dec 2021 14:24:28 +0000 Subject: [PATCH] Improved storage of headers. --- src/lib.rs | 299 +++++++------------ src/parsers/header.rs | 72 +++-- src/parsers/message.rs | 59 ++-- tests/legacy/000.txt | 334 +++++++++++---------- tests/legacy/001.txt | 318 ++++++++++---------- tests/legacy/002.txt | 270 +++++++++-------- tests/legacy/003.txt | 318 +++++++++----------- tests/legacy/004.txt | 244 ++++++++------- tests/legacy/005.txt | 306 ++++++++++--------- tests/legacy/006.txt | 398 +++++++++++-------------- tests/legacy/007.txt | 306 ++++++++++--------- tests/legacy/008.txt | 491 ++++++++++++------------------ tests/legacy/009.txt | 288 +++++++++--------- tests/legacy/010.txt | 270 +++++++++-------- tests/legacy/011.txt | 244 ++++++++------- tests/legacy/012.txt | 306 ++++++++++--------- tests/legacy/013.txt | 306 ++++++++++--------- tests/legacy/014.txt | 360 ++++++++++------------ tests/legacy/015.txt | 628 ++++++++++++++------------------------- tests/legacy/016.txt | 348 +++++++++------------- tests/legacy/017.txt | 365 ++++++++++------------- tests/legacy/018.txt | 485 ++++++++++++------------------ tests/legacy/019.txt | 497 +++++++++++++------------------ tests/legacy/020.txt | 304 ++++++++++--------- tests/legacy/021.txt | 569 ++++++++++++++--------------------- tests/legacy/022.txt | 308 ++++++++++--------- tests/legacy/023.txt | 418 ++++++++++---------------- tests/legacy/024.txt | 422 +++++++++++--------------- tests/legacy/025.txt | 561 +++++++++++++--------------------- tests/legacy/026.txt | 369 ++++++++++------------- tests/legacy/027.txt | 306 ++++++++++--------- tests/legacy/028.txt | 483 ++++++++++++------------------ tests/legacy/029.txt | 266 ++++++++--------- tests/legacy/030.txt | 433 +++++++++++---------------- tests/legacy/031.txt | 375 +++++++++-------------- tests/legacy/032.txt | 441 +++++++++++---------------- tests/legacy/033.txt | 266 ++++++++--------- tests/legacy/034.txt | 244 ++++++++------- tests/legacy/035.txt | 590 +++++++++++++----------------------- tests/legacy/036.txt | 206 +++++++------ tests/legacy/037.txt | 323 +++++++++----------- tests/legacy/038.txt | 244 ++++++++------- tests/legacy/039.txt | 533 ++++++++++++--------------------- tests/legacy/040.txt | 244 ++++++++------- tests/legacy/041.txt | 294 ++++++++---------- tests/legacy/042.txt | 319 +++++++++----------- tests/legacy/043.txt | 302 ++++++++----------- tests/legacy/044.txt | 433 +++++++++++---------------- tests/legacy/045.txt | 306 ++++++++----------- tests/legacy/046.txt | 246 ++++++++------- tests/legacy/047.txt | 321 +++++++++----------- tests/legacy/048.txt | 431 +++++++++++---------------- tests/legacy/049.txt | 234 ++++++++------- tests/legacy/050.txt | 424 +++++++++++--------------- tests/legacy/051.txt | 563 +++++++++++++---------------------- tests/legacy/052.txt | 234 ++++++++------- tests/legacy/053.txt | 306 ++++++++++--------- tests/malformed/000.txt | 73 +++-- tests/malformed/001.txt | 61 ++-- tests/malformed/002.txt | 36 ++- tests/malformed/003.txt | 82 ++--- tests/malformed/004.txt | 36 ++- tests/malformed/005.txt | 82 ++--- tests/malformed/006.txt | 82 ++--- tests/malformed/007.txt | 74 ++--- tests/malformed/008.txt | 82 ++--- tests/malformed/009.txt | 103 +++---- tests/malformed/010.txt | 116 ++++---- tests/malformed/011.txt | 103 +++---- tests/malformed/012.txt | 167 ++++------- tests/malformed/013.txt | 242 +++++---------- tests/malformed/014.txt | 57 ++-- tests/malformed/015.txt | 265 ++++++++--------- tests/malformed/016.txt | 128 +++----- tests/rfc/000.txt | 442 +++++++++++---------------- tests/rfc/001.txt | 271 ++++++++--------- tests/rfc/002.txt | 538 ++++++++++++++------------------- tests/rfc/003.txt | 233 ++++++--------- tests/rfc/004.txt | 387 ++++++++++++------------ tests/rfc/005.txt | 191 ++++++------ tests/rfc/006.txt | 206 +++++-------- tests/rfc/007.txt | 470 +++++++++-------------------- tests/thirdparty/000.txt | 118 +++----- tests/thirdparty/001.txt | 139 +++------ tests/thirdparty/002.txt | 146 +++------ tests/thirdparty/003.txt | 240 +++++---------- tests/thirdparty/004.txt | 270 +++++------------ tests/thirdparty/005.txt | Bin 6041 -> 3836 bytes tests/thirdparty/006.txt | 222 +++++--------- tests/thirdparty/007.txt | 338 +++++++++------------ tests/thirdparty/008.txt | 394 ++++++++++-------------- tests/thirdparty/009.txt | 137 ++++----- tests/thirdparty/010.txt | 123 +++----- 93 files changed, 11087 insertions(+), 15397 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5ac562f..b07cb8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -271,13 +271,24 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Default, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct Message<'x> { - #[cfg_attr(feature = "serde_support", serde(borrow))] #[cfg_attr( feature = "serde_support", - serde(skip_serializing_if = "Headers::is_empty") + serde(skip_serializing_if = "HashMap::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] - pub headers: Headers<'x>, + pub headers_rfc: RfcHeaders<'x>, + #[cfg_attr( + feature = "serde_support", + serde(skip_serializing_if = "HashMap::is_empty") + )] + #[cfg_attr(feature = "serde_support", serde(default))] + pub headers_other: OtherHeaders<'x>, + #[cfg_attr( + feature = "serde_support", + serde(skip_serializing_if = "Vec::is_empty") + )] + #[cfg_attr(feature = "serde_support", serde(default))] + pub headers_offsets: Vec>, #[cfg_attr( feature = "serde_support", @@ -303,6 +314,7 @@ pub struct Message<'x> { serde(skip_serializing_if = "Vec::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] + #[cfg_attr(feature = "serde_support", serde(borrow))] pub parts: Vec>, #[cfg_attr(feature = "serde_support", serde(default))] @@ -351,10 +363,10 @@ impl Default for MessageStructure { pub struct TextPart<'x> { #[cfg_attr( feature = "serde_support", - serde(skip_serializing_if = "Option::is_none") + serde(skip_serializing_if = "HashMap::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] - pub headers: Option>, + pub headers: RfcHeaders<'x>, pub contents: Cow<'x, str>, pub is_html: bool, } @@ -365,10 +377,10 @@ pub struct TextPart<'x> { pub struct BinaryPart<'x> { #[cfg_attr( feature = "serde_support", - serde(skip_serializing_if = "Option::is_none") + serde(skip_serializing_if = "HashMap::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] - pub headers: Option>, + pub headers: RfcHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(with = "serde_bytes"))] #[cfg_attr(feature = "serde_support", serde(borrow))] pub contents: Cow<'x, [u8]>, @@ -398,7 +410,7 @@ pub enum MessagePart<'x> { Message(Message<'x>), /// Multipart part - Multipart(Headers<'x>), + Multipart(RfcHeaders<'x>), } /// An RFC5322 or RFC2369 internet address. @@ -443,43 +455,8 @@ pub struct Group<'x> { pub addresses: Vec>, } -#[derive(Debug, Default, PartialEq)] -#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] -pub struct Headers<'x> { - #[cfg_attr( - feature = "serde_support", - serde(skip_serializing_if = "HashMap::is_empty") - )] - #[cfg_attr(feature = "serde_support", serde(default))] - pub values: HashMap>, - #[cfg_attr( - feature = "serde_support", - serde(skip_serializing_if = "HashMap::is_empty") - )] - #[cfg_attr(feature = "serde_support", serde(default))] - pub other_values: HashMap, HeaderValue<'x>>, - #[cfg_attr( - feature = "serde_support", - serde(skip_serializing_if = "Vec::is_empty") - )] - #[cfg_attr(feature = "serde_support", serde(default))] - pub offsets: Vec>, -} - -impl<'x> Headers<'x> { - pub fn new() -> Self { - Default::default() - } - - pub fn is_empty(&self) -> bool { - self.values.is_empty() && self.other_values.is_empty() && self.offsets.is_empty() - } - - pub fn clear(&mut self) { - self.values.clear(); - self.offsets.clear(); - } -} +pub type RfcHeaders<'x> = HashMap>; +pub type OtherHeaders<'x> = HashMap, HeaderValue<'x>>; /// Offset of a message element in the raw message. #[derive(Debug, PartialEq)] @@ -674,255 +651,224 @@ pub struct DateTime { } impl<'x> Message<'x> { - /// Returns an iterator over the headers of this message. - pub fn get_headers(&self) -> impl Iterator)> { - self.headers.values.iter() + /// Returns an iterator over the RFC headers of this message. + pub fn get_headers_rfc(&self) -> impl Iterator)> { + self.headers_rfc.iter() } /// Returns the BCC header field pub fn get_bcc(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Bcc) .unwrap_or(&HeaderValue::Empty) } /// Returns the CC header field pub fn get_cc(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Cc) .unwrap_or(&HeaderValue::Empty) } /// Returns all Comments header fields pub fn get_comments(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Comments) .unwrap_or(&HeaderValue::Empty) } /// Returns the Date header field pub fn get_date(&self) -> Option<&DateTime> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Date) .and_then(|header| header.as_datetime_ref()) } /// Returns the From header field pub fn get_from(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::From) .unwrap_or(&HeaderValue::Empty) } /// Returns all In-Reply-To header fields pub fn get_in_reply_to(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::InReplyTo) .unwrap_or(&HeaderValue::Empty) } /// Returns all Keywords header fields pub fn get_keywords(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Keywords) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Archive header field pub fn get_list_archive(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListArchive) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Help header field pub fn get_list_help(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListHelp) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-ID header field pub fn get_list_id(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListId) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Owner header field pub fn get_list_owner(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListOwner) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Post header field pub fn get_list_post(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListPost) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Subscribe header field pub fn get_list_subscribe(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListSubscribe) .unwrap_or(&HeaderValue::Empty) } /// Returns the List-Unsubscribe header field pub fn get_list_unsubscribe(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ListUnsubscribe) .unwrap_or(&HeaderValue::Empty) } /// Returns the Message-ID header field pub fn get_message_id(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::MessageId) .and_then(|header| header.as_text_ref()) } /// Returns the MIME-Version header field pub fn get_mime_version(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::MimeVersion) .unwrap_or(&HeaderValue::Empty) } /// Returns all Received header fields pub fn get_received(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Received) .unwrap_or(&HeaderValue::Empty) } /// Returns all References header fields pub fn get_references(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::References) .unwrap_or(&HeaderValue::Empty) } /// Returns the Reply-To header field pub fn get_reply_to(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ReplyTo) .unwrap_or(&HeaderValue::Empty) } /// Returns the Resent-BCC header field pub fn get_resent_bcc(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentBcc) .unwrap_or(&HeaderValue::Empty) } /// Returns the Resent-CC header field pub fn get_resent_cc(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentTo) .unwrap_or(&HeaderValue::Empty) } /// Returns all Resent-Date header fields pub fn get_resent_date(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentDate) .unwrap_or(&HeaderValue::Empty) } /// Returns the Resent-From header field pub fn get_resent_from(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentFrom) .unwrap_or(&HeaderValue::Empty) } /// Returns all Resent-Message-ID header fields pub fn get_resent_message_id(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentMessageId) .unwrap_or(&HeaderValue::Empty) } /// Returns the Sender header field pub fn get_resent_sender(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentSender) .unwrap_or(&HeaderValue::Empty) } /// Returns the Resent-To header field pub fn get_resent_to(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ResentTo) .unwrap_or(&HeaderValue::Empty) } /// Returns all Return-Path header fields pub fn get_return_path(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ReturnPath) .unwrap_or(&HeaderValue::Empty) } /// Returns the Sender header field pub fn get_sender(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Sender) .unwrap_or(&HeaderValue::Empty) } /// Returns the Subject header field pub fn get_subject(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::Subject) .and_then(|header| header.as_text_ref()) } /// Returns the To header field pub fn get_to(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::To) .unwrap_or(&HeaderValue::Empty) } /// Returns a non-standard header field pub fn get_other(&self, name: &'x str) -> &HeaderValue<'x> { - self.headers - .other_values + self.headers_other .get(&Cow::from(name)) .unwrap_or(&HeaderValue::Empty) } @@ -1029,50 +975,43 @@ pub trait MimeHeaders<'x> { impl<'x> MimeHeaders<'x> for Message<'x> { fn get_content_description(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentDescription) .and_then(|header| header.as_text_ref()) } fn get_content_disposition(&self) -> Option<&ContentType> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentDisposition) .and_then(|header| header.as_content_type_ref()) } fn get_content_id(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentId) .and_then(|header| header.as_text_ref()) } fn get_content_transfer_encoding(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentTransferEncoding) .and_then(|header| header.as_text_ref()) } fn get_content_type(&self) -> Option<&ContentType> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentType) .and_then(|header| header.as_content_type_ref()) } fn get_content_language(&self) -> &HeaderValue<'x> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentLanguage) .unwrap_or(&HeaderValue::Empty) } fn get_content_location(&self) -> Option<&str> { - self.headers - .values + self.headers_rfc .get(&HeaderName::ContentLocation) .and_then(|header| header.as_text_ref()) } @@ -1159,117 +1098,89 @@ impl<'x> fmt::Display for BinaryPart<'x> { impl<'x> MimeHeaders<'x> for TextPart<'x> { fn get_content_description(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentDescription) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentDescription) + .and_then(|header| header.as_text_ref()) } fn get_content_disposition(&self) -> Option<&ContentType> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentDisposition) - .and_then(|header| header.as_content_type_ref()) - }) + self.headers + .get(&HeaderName::ContentDisposition) + .and_then(|header| header.as_content_type_ref()) } fn get_content_id(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentId) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentId) + .and_then(|header| header.as_text_ref()) } fn get_content_transfer_encoding(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentTransferEncoding) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentTransferEncoding) + .and_then(|header| header.as_text_ref()) } fn get_content_type(&self) -> Option<&ContentType> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentType) - .and_then(|header| header.as_content_type_ref()) - }) + self.headers + .get(&HeaderName::ContentType) + .and_then(|header| header.as_content_type_ref()) } fn get_content_language(&self) -> &HeaderValue<'x> { - self.headers.as_ref().map_or(&HeaderValue::Empty, |h| { - h.values - .get(&HeaderName::ContentLanguage) - .unwrap_or(&HeaderValue::Empty) - }) + self.headers + .get(&HeaderName::ContentLanguage) + .unwrap_or(&HeaderValue::Empty) } fn get_content_location(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentLocation) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentLocation) + .and_then(|header| header.as_text_ref()) } } impl<'x> MimeHeaders<'x> for BinaryPart<'x> { fn get_content_description(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentDescription) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentDescription) + .and_then(|header| header.as_text_ref()) } fn get_content_disposition(&self) -> Option<&ContentType> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentDisposition) - .and_then(|header| header.as_content_type_ref()) - }) + self.headers + .get(&HeaderName::ContentDisposition) + .and_then(|header| header.as_content_type_ref()) } fn get_content_id(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentId) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentId) + .and_then(|header| header.as_text_ref()) } fn get_content_transfer_encoding(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentTransferEncoding) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentTransferEncoding) + .and_then(|header| header.as_text_ref()) } fn get_content_type(&self) -> Option<&ContentType> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentType) - .and_then(|header| header.as_content_type_ref()) - }) + self.headers + .get(&HeaderName::ContentType) + .and_then(|header| header.as_content_type_ref()) } fn get_content_language(&self) -> &HeaderValue<'x> { - self.headers.as_ref().map_or(&HeaderValue::Empty, |h| { - h.values - .get(&HeaderName::ContentLanguage) - .unwrap_or(&HeaderValue::Empty) - }) + self.headers + .get(&HeaderName::ContentLanguage) + .unwrap_or(&HeaderValue::Empty) } fn get_content_location(&self) -> Option<&str> { - self.headers.as_ref().and_then(|h| { - h.values - .get(&HeaderName::ContentLocation) - .and_then(|header| header.as_text_ref()) - }) + self.headers + .get(&HeaderName::ContentLocation) + .and_then(|header| header.as_text_ref()) } } diff --git a/src/parsers/header.rs b/src/parsers/header.rs index a46cfd7..1407f8a 100644 --- a/src/parsers/header.rs +++ b/src/parsers/header.rs @@ -11,7 +11,7 @@ use std::{borrow::Cow, collections::hash_map::Entry}; -use crate::{HeaderName, HeaderOffset, HeaderOffsetName, HeaderValue, Headers}; +use crate::{HeaderName, HeaderOffset, HeaderOffsetName, HeaderValue, OtherHeaders, RfcHeaders}; use super::{ fields::{ @@ -29,7 +29,12 @@ pub enum HeaderParserResult<'x> { Eof, } -pub fn parse_headers<'x>(headers: &mut Headers<'x>, stream: &mut MessageStream<'x>) -> bool { +pub fn parse_headers<'x>( + headers_rfc: &mut RfcHeaders<'x>, + mut headers_other: Option<&mut OtherHeaders<'x>>, + mut headers_offsets: Option<&mut Vec>>, + stream: &mut MessageStream<'x>, +) -> bool { loop { let (bytes_read, result) = parse_header_name(&stream.data[stream.pos..]); stream.pos += bytes_read; @@ -40,21 +45,23 @@ pub fn parse_headers<'x>(headers: &mut Headers<'x>, stream: &mut MessageStream<' let from_offset = stream.pos; let value = parser(stream); - headers.offsets.push(HeaderOffset { - name: HeaderOffsetName::Rfc(name), - start: from_offset, - end: stream.pos, - }); + if let Some(headers_offsets) = headers_offsets.as_mut() { + headers_offsets.push(HeaderOffset { + name: HeaderOffsetName::Rfc(name), + start: from_offset, + end: stream.pos, + }); + } if !value.is_empty() { if is_many { - match headers.values.entry(name) { + match headers_rfc.entry(name) { Entry::Occupied(mut e) => { if let HeaderValue::Collection(col) = e.get_mut() { col.push(value); } else { let old_value = e.remove(); - headers.values.insert( + headers_rfc.insert( name, HeaderValue::Collection(vec![old_value, value]), ); @@ -65,33 +72,38 @@ pub fn parse_headers<'x>(headers: &mut Headers<'x>, stream: &mut MessageStream<' } } } else { - headers.values.insert(name, value); + headers_rfc.insert(name, value); } } } HeaderParserResult::Other(name) => { - let from_offset = stream.pos; - let value = parse_raw(stream); - headers.offsets.push(HeaderOffset { - name: HeaderOffsetName::Other(name.clone()), - start: from_offset, - end: stream.pos, - }); + if let Some(headers_other) = headers_other.as_mut() { + let from_offset = stream.pos; + let value = parse_raw(stream); + if let Some(headers_offsets) = headers_offsets.as_mut() { + headers_offsets.push(HeaderOffset { + name: HeaderOffsetName::Other(name.clone()), + start: from_offset, + end: stream.pos, + }); + } - if !value.is_empty() { - match headers.other_values.entry(name.clone()) { - Entry::Occupied(mut e) => { - if let HeaderValue::Collection(col) = e.get_mut() { - col.push(value); - } else { - let old_value = e.remove(); - headers - .other_values - .insert(name, HeaderValue::Collection(vec![old_value, value])); + if !value.is_empty() { + match headers_other.entry(name.clone()) { + Entry::Occupied(mut e) => { + if let HeaderValue::Collection(col) = e.get_mut() { + col.push(value); + } else { + let old_value = e.remove(); + headers_other.insert( + name, + HeaderValue::Collection(vec![old_value, value]), + ); + } + } + Entry::Vacant(e) => { + e.insert(value); } - } - Entry::Vacant(e) => { - e.insert(value); } } } diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 20bc8cc..7e59ed5 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -16,8 +16,8 @@ use crate::{ base64::decode_base64, charsets::map::get_charset_decoder, quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult, }, - AttachmentType, BinaryPart, ContentType, HeaderName, HeaderValue, Headers, Message, - MessagePart, MessagePartId, MessageStructure, TextPart, + AttachmentType, BinaryPart, ContentType, HeaderName, HeaderValue, Message, MessagePart, + MessagePartId, MessageStructure, RfcHeaders, TextPart, }; use super::{ @@ -170,14 +170,13 @@ impl<'x> MessageStream<'x> { impl<'x> Message<'x> { fn new() -> Message<'x> { Message { - headers: Headers::new(), ..Default::default() } } /// Returns `false` if at least one header field was successfully parsed. pub fn is_empty(&self) -> bool { - self.headers.is_empty() + self.headers_rfc.is_empty() && self.headers_other.is_empty() } /// Parses a byte slice containing the RFC5322 raw message and returns a @@ -195,28 +194,32 @@ impl<'x> Message<'x> { let mut state = MessageParserState::new(); let mut state_stack = Vec::new(); - let mut mime_part_header = Headers::new(); + let mut mime_part_header = RfcHeaders::new(); 'outer: loop { - // Obtain reference to either the message or the MIME part's header + // Parse headers let (is_message, header) = if let MimeType::Message = state.mime_type { message.offset_header = stream.pos; - (true, &mut message.headers) + if !parse_headers( + &mut message.headers_rfc, + Some(&mut message.headers_other), + Some(&mut message.headers_offsets), + &mut stream, + ) { + break; + } + message.offset_body = seek_crlf_end(&stream, stream.pos); + (true, &mut message.headers_rfc) } else { + if !parse_headers(&mut mime_part_header, None, None, &mut stream) { + break; + } (false, &mut mime_part_header) }; - // Parse headers - if !parse_headers(header, &mut stream) { - break; - } else if is_message { - message.offset_body = seek_crlf_end(&stream, stream.pos); - } - state.parts += 1; let content_type = header - .values .get(&HeaderName::ContentType) .and_then(|c| c.as_content_type_ref()); @@ -248,7 +251,7 @@ impl<'x> Message<'x> { }; if !is_message { if mime_part_header.is_empty() { - mime_part_header.values.insert( + mime_part_header.insert( HeaderName::ContentType, HeaderValue::ContentType(ContentType { c_type: "text".into(), @@ -279,7 +282,7 @@ impl<'x> Message<'x> { ..Default::default() }; if mime_part_header.is_empty() { - mime_part_header.values.insert( + mime_part_header.insert( HeaderName::ContentType, HeaderValue::ContentType(ContentType { c_type: "message".into(), @@ -305,7 +308,6 @@ impl<'x> Message<'x> { skip_crlf(&mut stream); let (is_binary, decode_fnc): (bool, DecodeFnc) = match header - .values .get(&HeaderName::ContentTransferEncoding) { Some(HeaderValue::Text(encoding)) if encoding.eq_ignore_ascii_case("base64") => { @@ -377,7 +379,6 @@ impl<'x> Message<'x> { let is_inline = is_inline && header - .values .get(&HeaderName::ContentDisposition) .map_or_else(|| true, |d| !d.get_content_type().is_attachment()) && (state.parts == 1 @@ -413,11 +414,7 @@ impl<'x> Message<'x> { let is_html = mime_type == MimeType::TextHtml; let text_part = TextPart { contents: result_to_string(bytes, stream.data, content_type), - headers: if !mime_part_header.is_empty() { - Some(std::mem::take(&mut mime_part_header)) - } else { - None - }, + headers: std::mem::take(&mut mime_part_header), is_html, }; @@ -459,11 +456,7 @@ impl<'x> Message<'x> { .push(MessageStructure::Part(message.parts.len())); message.parts.push(MessagePart::Binary(BinaryPart { - headers: if !mime_part_header.is_empty() { - Some(std::mem::take(&mut mime_part_header)) - } else { - None - }, + headers: std::mem::take(&mut mime_part_header), contents: result_to_bytes(bytes, stream.data), })); }; @@ -630,7 +623,7 @@ mod tests { } } - /*#[test] + #[test] fn message_to_yaml() { let mut file_name = PathBuf::from(env!("CARGO_MANIFEST_DIR")); file_name.push("tests"); @@ -655,9 +648,9 @@ mod tests { let input = input.split_at_mut(pos); let message = Message::parse(input.0).unwrap(); - let result = serde_json::to_string_pretty(&message).unwrap(); //serde_yaml::to_string(&message).unwrap(); + let result = serde_yaml::to_string(&message).unwrap(); - //fs::write("test.yaml", &result).unwrap(); + fs::write("test.yaml", &result).unwrap(); println!("{}", result); } @@ -710,5 +703,5 @@ mod tests { fs::write(file_name.as_ref().unwrap().path(), &output).unwrap(); } } - }*/ + } } diff --git a/tests/legacy/000.txt b/tests/legacy/000.txt index 7af6c29..c6a2240 100644 --- a/tests/legacy/000.txt +++ b/tests/legacy/000.txt @@ -44,181 +44,179 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 35, - "second": 5, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" } } }, - "other_values": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 291 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 317, - "end": 326 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 346, - "end": 385 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 396, - "end": 409 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 427, - "end": 436 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 445, - "end": 498 - }, - { - "name": { - "Other": "Importance" - }, - "start": 509, - "end": 518 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 528, - "end": 576 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } - ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 35, + "second": 5, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + } }, + "headers_other": { + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 238, + "end": 244 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 257, + "end": 291 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 317, + "end": 326 + }, + { + "name": { + "Rfc": "content_disposition" + }, + "start": 346, + "end": 385 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 396, + "end": 409 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 427, + "end": 436 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 445, + "end": 498 + }, + { + "name": { + "Other": "Importance" + }, + "start": 509, + "end": 518 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 528, + "end": 576 + } + ], "attachments": [ { "Attachment": 0 diff --git a/tests/legacy/001.txt b/tests/legacy/001.txt index 7922abb..c1e58cf 100644 --- a/tests/legacy/001.txt +++ b/tests/legacy/001.txt @@ -35,172 +35,170 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "jblow@example.com" - }, - { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - ] - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 18, - "second": 39, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "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_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 18, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Priority": { - "Text": "3 (Normal)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 39 - }, - { - "name": { - "Rfc": "to" - }, - "start": 42, - "end": 146 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 154, - "end": 224 - }, - { - "name": { - "Rfc": "date" - }, - "start": 229, - "end": 262 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 273, - "end": 322 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 335, - "end": 340 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 353, - "end": 383 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 409, - "end": 427 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 438, - "end": 450 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 468, - "end": 476 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 485, - "end": 537 - }, - { - "name": { - "Other": "Importance" - }, - "start": 548, - "end": 556 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 566, - "end": 613 + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-7" + } } - ] + }, + "to": { + "AddressList": [ + { + "name": "Joe Blow", + "address": "jblow@example.com" + }, + { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + ] + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 39 + }, + { + "name": { + "Rfc": "to" + }, + "start": 42, + "end": 146 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 154, + "end": 224 + }, + { + "name": { + "Rfc": "date" + }, + "start": 229, + "end": 262 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 273, + "end": 322 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 335, + "end": 340 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 353, + "end": 383 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 409, + "end": 427 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 438, + "end": 450 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 468, + "end": 476 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 485, + "end": 537 + }, + { + "name": { + "Other": "Importance" + }, + "start": 548, + "end": 556 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 566, + "end": 613 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/002.txt b/tests/legacy/002.txt index a7955ae..5fc92c0 100644 --- a/tests/legacy/002.txt +++ b/tests/legacy/002.txt @@ -37,146 +37,144 @@ wir."
---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "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.20000519003052.00a89c40@pop.example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 31, - "second": 0, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 31, + "second": 0, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 290 - }, - { - "name": { - "Rfc": "from" - }, - "start": 295, - "end": 332 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 340, - "end": 387 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 400, - "end": 406 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 419, - "end": 453 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 479, - "end": 498 - } - ] + "subject": { + "Text": "Die Hasen und die Frösche" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 290 + }, + { + "name": { + "Rfc": "from" + }, + "start": 295, + "end": 332 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 340, + "end": 387 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 400, + "end": 406 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 419, + "end": 453 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 479, + "end": 498 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/003.txt b/tests/legacy/003.txt index 3a43df8..134a116 100644 --- a/tests/legacy/003.txt +++ b/tests/legacy/003.txt @@ -64,136 +64,134 @@ wir."
---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_714967308==_.ALT" - } + "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "=====================_714967308==_.ALT" } - }, - "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" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 29, - "second": 55, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 290 - }, - { - "name": { - "Rfc": "from" - }, - "start": 295, - "end": 332 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 340, - "end": 387 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 400, - "end": 406 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 419, - "end": 496 + "message_id": { + "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 29, + "second": 55, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + } }, + "headers_other": { + "X-Priority": { + "Text": "2 (High)" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 290 + }, + { + "name": { + "Rfc": "from" + }, + "start": 295, + "end": 332 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 340, + "end": 387 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 400, + "end": 406 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 419, + "end": 496 + } + ], "html_body": [ 1 ], @@ -204,36 +202,18 @@ wir."
{ "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 553, - "end": 588 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 614, - "end": 633 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "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", "is_html": false @@ -242,36 +222,18 @@ wir."
{ "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1501, - "end": 1535 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1561, - "end": 1580 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": true diff --git a/tests/legacy/004.txt b/tests/legacy/004.txt index f643ad3..d6739ef 100644 --- a/tests/legacy/004.txt +++ b/tests/legacy/004.txt @@ -19,136 +19,134 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@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" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 13, - "second": 19, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "5 (Lowest)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "to" - }, - "start": 236, - "end": 266 - }, - { - "name": { - "Rfc": "from" - }, - "start": 271, - "end": 308 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 316, - "end": 344 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 357, - "end": 363 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 376, - "end": 409 + "message_id": { + "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 13, + "second": 19, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "The Hare and the Tortoise" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "5 (Lowest)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 194 + }, + { + "name": { + "Rfc": "date" + }, + "start": 199, + "end": 233 + }, + { + "name": { + "Rfc": "to" + }, + "start": 236, + "end": 266 + }, + { + "name": { + "Rfc": "from" + }, + "start": 271, + "end": 308 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 316, + "end": 344 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 357, + "end": 363 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 376, + "end": 409 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/005.txt b/tests/legacy/005.txt index 574d6b6..2237ae6 100644 --- a/tests/legacy/005.txt +++ b/tests/legacy/005.txt @@ -33,166 +33,164 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 20, - "second": 24, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 20, + "second": 24, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 96 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 104, - "end": 175 - }, - { - "name": { - "Rfc": "date" - }, - "start": 180, - "end": 214 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 225, - "end": 275 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 288, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 339 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 365, - "end": 384 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 395, - "end": 408 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 426, - "end": 435 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 444, - "end": 497 - }, - { - "name": { - "Other": "Importance" - }, - "start": 508, - "end": 517 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 527, - "end": 575 + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-7" + } } - ] + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com" + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-MSMail-Priority": { + "Text": "Normal" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 96 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 104, + "end": 175 + }, + { + "name": { + "Rfc": "date" + }, + "start": 180, + "end": 214 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 225, + "end": 275 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 288, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 339 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 365, + "end": 384 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 395, + "end": 408 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 426, + "end": 435 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 444, + "end": 497 + }, + { + "name": { + "Other": "Importance" + }, + "start": 508, + "end": 517 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 527, + "end": 575 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/006.txt b/tests/legacy/006.txt index 7e8b3d4..ec2c11a 100644 --- a/tests/legacy/006.txt +++ b/tests/legacy/006.txt @@ -84,156 +84,154 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" - } - } - }, - "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": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 36, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" } } }, - "other_values": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 36, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + } }, + "headers_other": { + "X-Priority": { + "Text": "3 (Normal)" + }, + "Importance": { + "Text": "Normal" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 238, + "end": 244 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 257, + "end": 331 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 342, + "end": 355 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 373, + "end": 382 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 391, + "end": 444 + }, + { + "name": { + "Other": "Importance" + }, + "start": 455, + "end": 464 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 474, + "end": 522 + } + ], "attachments": [ { "Attachment": 0 @@ -246,51 +244,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 630, - "end": 665 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 691, - "end": 700 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 720, - "end": 760 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1624,51 +1597,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 2638, - "end": 2672 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2698, - "end": 2707 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2727, - "end": 2766 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/007.txt b/tests/legacy/007.txt index d91c526..80b36d7 100644 --- a/tests/legacy/007.txt +++ b/tests/legacy/007.txt @@ -32,166 +32,164 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 15, - "second": 35, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "other_values": { - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MSMail-Priority": { - "Text": "Normal" + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 112 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 120, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 244, - "end": 294 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 307, - "end": 313 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 326, - "end": 363 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 389, - "end": 408 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 419, - "end": 432 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 450, - "end": 459 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 468, - "end": 521 - }, - { - "name": { - "Other": "Importance" - }, - "start": 532, - "end": 541 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 551, - "end": 599 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 15, + "second": 35, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 112 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 120, + "end": 194 + }, + { + "name": { + "Rfc": "date" + }, + "start": 199, + "end": 233 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 244, + "end": 294 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 307, + "end": 313 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 326, + "end": 363 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 389, + "end": 408 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 419, + "end": 432 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 450, + "end": 459 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 468, + "end": 521 + }, + { + "name": { + "Other": "Importance" + }, + "start": 532, + "end": 541 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 551, + "end": 599 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/008.txt b/tests/legacy/008.txt index 7299709..4a7a41e 100644 --- a/tests/legacy/008.txt +++ b/tests/legacy/008.txt @@ -136,156 +136,154 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 32, - "second": 47, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" } } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "Importance": { - "Text": "Normal" - }, - "X-MSMail-Priority": { - "Text": "Normal" + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 32, + "second": 47, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 99 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 107, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 354 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 365, - "end": 378 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 396, - "end": 405 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 414, - "end": 467 - }, - { - "name": { - "Other": "Importance" - }, - "start": 478, - "end": 487 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 497, - "end": 545 + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } - ] + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "Importance": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 99 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 107, + "end": 148 + }, + { + "name": { + "Rfc": "date" + }, + "start": 153, + "end": 187 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 198, + "end": 248 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 261, + "end": 267 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 280, + "end": 354 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 365, + "end": 378 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 396, + "end": 405 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 414, + "end": 467 + }, + { + "name": { + "Other": "Importance" + }, + "start": 478, + "end": 487 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 497, + "end": 545 + } + ], "html_body": [ 0 ], @@ -307,36 +305,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 653, - "end": 690 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 716, - "end": 735 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": false @@ -345,51 +325,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1596, - "end": 1631 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1657, - "end": 1666 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1686, - "end": 1726 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -1723,51 +1678,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3604, - "end": 3640 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3666, - "end": 3675 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3695, - "end": 3736 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -3074,51 +3004,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5576, - "end": 5610 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5636, - "end": 5645 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5665, - "end": 5704 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/009.txt b/tests/legacy/009.txt index 8ba7c02..4c7edd9 100644 --- a/tests/legacy/009.txt +++ b/tests/legacy/009.txt @@ -37,157 +37,155 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 6, - "second": 18, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1", - "format": "flowed" - } - } + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "mime_version": { + "Text": "1.0" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 6, + "second": 18, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "other_values": { - "X-Priority": { - "Text": "1 (Highest)" - }, - "Disposition-Notification-To": { - "Text": "" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "message_id": { + "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "Disposition-Notification-To" - }, - "start": 141, - "end": 166 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 175, - "end": 223 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 234, - "end": 248 - }, - { - "name": { - "Rfc": "date" - }, - "start": 253, - "end": 287 - }, - { - "name": { - "Rfc": "to" - }, - "start": 290, - "end": 373 - }, - { - "name": { - "Rfc": "from" - }, - "start": 378, - "end": 415 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 423, - "end": 468 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 481, - "end": 487 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 500, - "end": 550 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 576, - "end": 595 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } - ] + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "format": "flowed", + "charset": "iso-8859-1" + } + } + } }, + "headers_other": { + "Disposition-Notification-To": { + "Text": "" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Priority": { + "Text": "1 (Highest)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "Disposition-Notification-To" + }, + "start": 141, + "end": 166 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 175, + "end": 223 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 234, + "end": 248 + }, + { + "name": { + "Rfc": "date" + }, + "start": 253, + "end": 287 + }, + { + "name": { + "Rfc": "to" + }, + "start": 290, + "end": 373 + }, + { + "name": { + "Rfc": "from" + }, + "start": 378, + "end": 415 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 423, + "end": 468 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 481, + "end": 487 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 500, + "end": 550 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 576, + "end": 595 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/010.txt b/tests/legacy/010.txt index 3025d4e..4a53bdd 100644 --- a/tests/legacy/010.txt +++ b/tests/legacy/010.txt @@ -22,146 +22,144 @@ In einem nahen Teich wollten sie sich nun ers ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" - }, - "subject": { - "Text": "Die Hasen und die Fr�sche" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 1, - "minute": 10, - "second": 27, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Heinz M�ller", - "address": "mueller@example.com" - } - }, - "content_transfer_encoding": { - "Text": "8bit" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Fr�sche" + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Heinz M�ller", + "address": "mueller@example.com" + } + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 1, + "minute": 10, + "second": 27, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "1 (Highest)" - } - }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 195 - }, - { - "name": { - "Rfc": "date" - }, - "start": 200, - "end": 234 - }, - { - "name": { - "Rfc": "to" - }, - "start": 237, - "end": 274 - }, - { - "name": { - "Rfc": "from" - }, - "start": 279, - "end": 316 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 324, - "end": 352 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 365, - "end": 371 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 384, - "end": 419 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 445, - "end": 452 - } - ] + "message_id": { + "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" + } }, + "headers_other": { + "X-Priority": { + "Text": "1 (Highest)" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 195 + }, + { + "name": { + "Rfc": "date" + }, + "start": 200, + "end": 234 + }, + { + "name": { + "Rfc": "to" + }, + "start": 237, + "end": 274 + }, + { + "name": { + "Rfc": "from" + }, + "start": 279, + "end": 316 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 324, + "end": 352 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 365, + "end": 371 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 384, + "end": 419 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 445, + "end": 452 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/011.txt b/tests/legacy/011.txt index 12dc284..10c1f49 100644 --- a/tests/legacy/011.txt +++ b/tests/legacy/011.txt @@ -30,136 +30,134 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 17, - "second": 39, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 299 - }, - { - "name": { - "Rfc": "from" - }, - "start": 304, - "end": 341 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 349, - "end": 396 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 409, - "end": 415 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 428, - "end": 463 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 489, - "end": 508 + "message_id": { + "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 17, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Rfc": "date" + }, + "start": 175, + "end": 209 + }, + { + "name": { + "Rfc": "to" + }, + "start": 212, + "end": 299 + }, + { + "name": { + "Rfc": "from" + }, + "start": 304, + "end": 341 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 349, + "end": 396 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 409, + "end": 415 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 428, + "end": 463 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 489, + "end": 508 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/012.txt b/tests/legacy/012.txt index f3d97df..f2280f9 100644 --- a/tests/legacy/012.txt +++ b/tests/legacy/012.txt @@ -31,166 +31,164 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "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": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 30, - "second": 20, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "Windows-1252" - } + "headers_rfc": { + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "Windows-1252" } } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - } + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 101 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 109, - "end": 185 - }, - { - "name": { - "Rfc": "date" - }, - "start": 190, - "end": 224 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 235, - "end": 285 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 298, - "end": 304 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 317, - "end": 356 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 382, - "end": 401 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 412, - "end": 425 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 443, - "end": 452 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 461, - "end": 514 - }, - { - "name": { - "Other": "Importance" - }, - "start": 525, - "end": 534 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 544, - "end": 592 + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 30, + "second": 20, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 101 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 109, + "end": 185 + }, + { + "name": { + "Rfc": "date" + }, + "start": 190, + "end": 224 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 235, + "end": 285 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 298, + "end": 304 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 317, + "end": 356 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 382, + "end": 401 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 412, + "end": 425 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 443, + "end": 452 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 461, + "end": 514 + }, + { + "name": { + "Other": "Importance" + }, + "start": 525, + "end": 534 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 544, + "end": 592 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/013.txt b/tests/legacy/013.txt index facd77a..459a870 100644 --- a/tests/legacy/013.txt +++ b/tests/legacy/013.txt @@ -32,166 +32,164 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_transfer_encoding": { - "Text": "8bit" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 13, - "second": 51, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" + "headers_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 112 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 120, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 244, - "end": 294 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 307, - "end": 313 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 326, - "end": 363 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 389, - "end": 396 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 407, - "end": 420 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 438, - "end": 447 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 456, - "end": 509 - }, - { - "name": { - "Other": "Importance" - }, - "start": 520, - "end": 529 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 539, - "end": 587 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 13, + "second": 51, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + } }, + "headers_other": { + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 112 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 120, + "end": 194 + }, + { + "name": { + "Rfc": "date" + }, + "start": 199, + "end": 233 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 244, + "end": 294 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 307, + "end": 313 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 326, + "end": 363 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 389, + "end": 396 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 407, + "end": 420 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 438, + "end": 447 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 456, + "end": 509 + }, + { + "name": { + "Other": "Importance" + }, + "start": 520, + "end": 529 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 539, + "end": 587 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/014.txt b/tests/legacy/014.txt index cca8912..46d1667 100644 --- a/tests/legacy/014.txt +++ b/tests/legacy/014.txt @@ -73,156 +73,154 @@ race. =20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 38, - "second": 28, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" - } + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 38, + "second": 28, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" } } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 337 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 348, - "end": 361 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 379, - "end": 388 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 397, - "end": 450 - }, - { - "name": { - "Other": "Importance" - }, - "start": 461, - "end": 470 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 480, - "end": 528 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } - ] + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-MSMail-Priority": { + "Text": "Normal" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 238, + "end": 244 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 257, + "end": 337 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 348, + "end": 361 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 379, + "end": 388 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 397, + "end": 450 + }, + { + "name": { + "Other": "Importance" + }, + "start": 461, + "end": 470 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 480, + "end": 528 + } + ], "html_body": [ 1 ], @@ -233,36 +231,18 @@ race. =20 { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 636, - "end": 673 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 699, - "end": 718 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "\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", "is_html": false @@ -271,36 +251,18 @@ race. =20 { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1581, - "end": 1617 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1643, - "end": 1662 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "\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", "is_html": true diff --git a/tests/legacy/015.txt b/tests/legacy/015.txt index 31da168..91b94d6 100644 --- a/tests/legacy/015.txt +++ b/tests/legacy/015.txt @@ -199,136 +199,134 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 36, - "second": 58, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715392540==_" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "mime_version": { - "Text": "1.0" + "headers_rfc": { + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Priority": { - "Text": "2 (High)" + "message_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715392540==_" + } } - ] + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 36, + "second": 58, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 482 + } + ], "html_body": [ 3 ], @@ -352,86 +350,46 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "=====================_715392540==_.REL", - "type": "multipart/alternative" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "=====================_715392540==_.REL", + "type": "multipart/alternative" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 535, - "end": 640 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_715392550==_.ALT" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "=====================_715392550==_.ALT" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 697, - "end": 774 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 831, - "end": 866 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 892, - "end": 911 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "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", "is_html": false @@ -440,36 +398,18 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1803, - "end": 1837 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1863, - "end": 1882 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "\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", "is_html": true @@ -478,61 +418,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa3ed95.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa3ed95.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa3ed95.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3217, - "end": 3250 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3261, - "end": 3316 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3342, - "end": 3351 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3371, - "end": 3405 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa3ed95.png" + } } - ] + }, + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + } }, "contents": [ 137, @@ -1866,61 +1774,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa3edd1.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa3edd1.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa3edd1.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5278, - "end": 5311 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 5322, - "end": 5377 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5403, - "end": 5412 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5432, - "end": 5466 + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa3edd1.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -3382,51 +3258,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 7557, - "end": 7590 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 7616, - "end": 7625 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 7645, - "end": 7683 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -4760,51 +4611,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 9552, - "end": 9586 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 9612, - "end": 9621 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 9641, - "end": 9680 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/016.txt b/tests/legacy/016.txt index 1372bf2..b151944 100644 --- a/tests/legacy/016.txt +++ b/tests/legacy/016.txt @@ -96,126 +96,124 @@ JB@ac)(GTFLiL)!d09'8!!!: ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 53, - "second": 25, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" - }, - "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": "=====================_716373961==_" - } + "headers_rfc": { + "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==_" } } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "message_id": { + "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 53, + "second": 25, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 295 - }, - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 337 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 345, - "end": 390 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 403, - "end": 409 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 422, - "end": 489 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } - ] + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Rfc": "date" + }, + "start": 175, + "end": 209 + }, + { + "name": { + "Rfc": "to" + }, + "start": 212, + "end": 295 + }, + { + "name": { + "Rfc": "from" + }, + "start": 300, + "end": 337 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 345, + "end": 390 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 403, + "end": 409 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 422, + "end": 489 + } + ], "html_body": [ 0 ], @@ -234,36 +232,18 @@ JB@ac)(GTFLiL)!d09'8!!!: { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 542, - "end": 577 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 603, - "end": 622 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false @@ -272,41 +252,23 @@ JB@ac)(GTFLiL)!d09'8!!!: { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "mac-binhex40", - "attributes": { - "name": "blueball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1486, - "end": 1534 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1554, - "end": 1592 + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "mac-binhex40", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 13, @@ -2245,41 +2207,23 @@ JB@ac)(GTFLiL)!d09'8!!!: { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "mac-binhex40", - "attributes": { - "name": "HasenundFr�sche.txt" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "HasenundFr�sche.txt" - } + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "mac-binhex40", + "attributes": { + "name": "HasenundFr�sche.txt" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3576, - "end": 3631 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3651, - "end": 3696 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "HasenundFr�sche.txt" + } } - ] + } }, "contents": [ 13, diff --git a/tests/legacy/017.txt b/tests/legacy/017.txt index 0ec29da..d8cdf07 100644 --- a/tests/legacy/017.txt +++ b/tests/legacy/017.txt @@ -103,126 +103,124 @@ end ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "The Hare and the Tortoise" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716177458==_" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 50, - "second": 8, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "jschmuergen@example.com" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "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": "=====================_716177458==_" } } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "message_id": { + "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 50, + "second": 8, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 257 - }, - { - "name": { - "Rfc": "from" - }, - "start": 262, - "end": 299 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 307, - "end": 335 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 348, - "end": 354 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 367, - "end": 434 - } - ] + "subject": { + "Text": "The Hare and the Tortoise" + } }, + "headers_other": { + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Rfc": "date" + }, + "start": 175, + "end": 209 + }, + { + "name": { + "Rfc": "to" + }, + "start": 212, + "end": 257 + }, + { + "name": { + "Rfc": "from" + }, + "start": 262, + "end": 299 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 307, + "end": 335 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 348, + "end": 354 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 367, + "end": 434 + } + ], "html_body": [ 0 ], @@ -241,26 +239,15 @@ end { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 487, - "end": 520 - } - ] + } }, "contents": "\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", "is_html": false @@ -269,51 +256,26 @@ end { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1339, - "end": 1373 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1399, - "end": 1412 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1432, - "end": 1471 + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + } }, "contents": [ 13, @@ -2177,51 +2139,26 @@ end { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3380, - "end": 3413 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3439, - "end": 3452 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3472, - "end": 3510 + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 13, diff --git a/tests/legacy/018.txt b/tests/legacy/018.txt index c3f51d3..ceb2e4a 100644 --- a/tests/legacy/018.txt +++ b/tests/legacy/018.txt @@ -139,137 +139,135 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 33, - "second": 1, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "=====================_715157131==_.REL", - "type": "multipart/alternative" - } - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "=====================_715157131==_.REL", + "type": "multipart/alternative" } } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Priority": { - "Text": "2 (High)" + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 520 + "message_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 33, + "second": 1, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 520 + } + ], "html_body": [ 2 ], @@ -287,61 +285,32 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_715157141==_.ALT" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "=====================_715157141==_.ALT" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 577, - "end": 654 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 711, - "end": 746 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 772, - "end": 791 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false @@ -350,36 +319,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1686, - "end": 1720 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1746, - "end": 1765 - } - ] + } }, "contents": "\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", "is_html": true @@ -388,61 +339,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3108, - "end": 3141 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3152, - "end": 3207 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3233, - "end": 3242 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3262, - "end": 3296 + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -1776,61 +1695,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "redball.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "redball.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5169, - "end": 5201 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 5212, - "end": 5267 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5293, - "end": 5302 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5322, - "end": 5355 + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/019.txt b/tests/legacy/019.txt index 2bb8e4e..3ac665a 100644 --- a/tests/legacy/019.txt +++ b/tests/legacy/019.txt @@ -145,156 +145,154 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0008_01BFC037.FDD8EE90" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0008_01BFC037.FDD8EE90" } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 42, - "second": 10, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 42, + "second": 10, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 238, + "end": 244 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 257, + "end": 331 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 342, + "end": 355 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 373, + "end": 382 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 391, + "end": 444 + }, + { + "name": { + "Other": "Importance" + }, + "start": 455, + "end": 464 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 474, + "end": 522 + } + ], "html_body": [ 2 ], @@ -312,61 +310,32 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_001_0009_01BFC037.FDD8EE90" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "----=_NextPart_001_0009_01BFC037.FDD8EE90" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 630, - "end": 710 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 772, - "end": 809 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 835, - "end": 854 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": false @@ -375,36 +344,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1717, - "end": 1753 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1779, - "end": 1798 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "\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", "is_html": true @@ -413,51 +364,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3099, - "end": 3135 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3161, - "end": 3170 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3190, - "end": 3231 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } } - ] + } }, "contents": [ 137, @@ -1764,51 +1690,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5071, - "end": 5105 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5131, - "end": 5140 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5160, - "end": 5199 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/020.txt b/tests/legacy/020.txt index b03eb06..3ff744b 100644 --- a/tests/legacy/020.txt +++ b/tests/legacy/020.txt @@ -32,166 +32,164 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" - }, - "content_transfer_encoding": { - "Text": "8bit" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 8, - "second": 29, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "headers_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 8, + "second": 29, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 89 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 97, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 317 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 343, - "end": 350 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 361, - "end": 374 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 392, - "end": 401 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 410, - "end": 463 - }, - { - "name": { - "Other": "Importance" - }, - "start": 474, - "end": 483 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 493, - "end": 541 + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "schmuergen@example.com" } - ] + }, + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 89 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 97, + "end": 148 + }, + { + "name": { + "Rfc": "date" + }, + "start": 153, + "end": 187 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 198, + "end": 248 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 261, + "end": 267 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 280, + "end": 317 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 343, + "end": 350 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 361, + "end": 374 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 392, + "end": 401 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 410, + "end": 463 + }, + { + "name": { + "Other": "Importance" + }, + "start": 474, + "end": 483 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 493, + "end": 541 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/021.txt b/tests/legacy/021.txt index 5fb73b3..c63595b 100644 --- a/tests/legacy/021.txt +++ b/tests/legacy/021.txt @@ -189,156 +189,154 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 47, - "second": 24, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" } }, - "other_values": { - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 47, + "second": 24, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" } - ] + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + } }, + "headers_other": { + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "Importance": { + "Text": "Normal" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 238, + "end": 244 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 257, + "end": 331 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 342, + "end": 355 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 373, + "end": 382 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 391, + "end": 444 + }, + { + "name": { + "Other": "Importance" + }, + "start": 455, + "end": 464 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 474, + "end": 522 + } + ], "html_body": [ 3 ], @@ -359,85 +357,45 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "----=_NextPart_001_0011_01BFC038.B91BC650" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "----=_NextPart_001_0011_01BFC038.B91BC650" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 630, - "end": 706 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_002_0012_01BFC038.B91BC650" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "----=_NextPart_002_0012_01BFC038.B91BC650" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 768, - "end": 848 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 910, - "end": 947 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 973, - "end": 992 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": false @@ -446,36 +404,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1859, - "end": 1895 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1921, - "end": 1940 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": true @@ -484,46 +424,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "938014623@17052000-0f9b" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_id": { + "Text": "938014623@17052000-0f9b" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3448, - "end": 3483 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3509, - "end": 3518 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3529, - "end": 3557 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1857,51 +1772,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5484, - "end": 5520 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5546, - "end": 5555 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5575, - "end": 5616 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } } - ] + } }, "contents": [ 137, @@ -3208,51 +3098,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 7456, - "end": 7490 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 7516, - "end": 7525 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 7545, - "end": 7584 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/022.txt b/tests/legacy/022.txt index 8ee2717..6d405fb 100644 --- a/tests/legacy/022.txt +++ b/tests/legacy/022.txt @@ -31,166 +31,164 @@ IiANCg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 11, - "second": 50, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 11, + "second": 50, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "schmuergen@example.com" } - }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 89 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 97, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 317 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 343, - "end": 352 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 363, - "end": 376 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 394, - "end": 403 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 412, - "end": 465 - }, - { - "name": { - "Other": "Importance" - }, - "start": 476, - "end": 485 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 495, - "end": 543 - } - ] + } }, + "headers_other": { + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "Importance": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 89 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 97, + "end": 148 + }, + { + "name": { + "Rfc": "date" + }, + "start": 153, + "end": 187 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 198, + "end": 248 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 261, + "end": 267 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 280, + "end": 317 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 343, + "end": 352 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 363, + "end": 376 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 394, + "end": 403 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 412, + "end": 465 + }, + { + "name": { + "Other": "Importance" + }, + "start": 476, + "end": 485 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 495, + "end": 543 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/023.txt b/tests/legacy/023.txt index d54be32..16bde11 100644 --- a/tests/legacy/023.txt +++ b/tests/legacy/023.txt @@ -109,126 +109,124 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 56, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716541962==_" } - }, - "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" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 295 - }, - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 337 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 345, - "end": 390 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 403, - "end": 409 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 422, - "end": 489 + "message_id": { + "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 56, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Rfc": "date" + }, + "start": 175, + "end": 209 + }, + { + "name": { + "Rfc": "to" + }, + "start": 212, + "end": 295 + }, + { + "name": { + "Rfc": "from" + }, + "start": 300, + "end": 337 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 345, + "end": 390 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 403, + "end": 409 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 422, + "end": 489 + } + ], "html_body": [ 0 ], @@ -250,36 +248,18 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 542, - "end": 577 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 603, - "end": 622 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false @@ -288,51 +268,26 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1486, - "end": 1519 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1545, - "end": 1554 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1574, - "end": 1612 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -1666,41 +1621,23 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "farmerandstork.txt" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3481, - "end": 3514 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3534, - "end": 3578 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "farmerandstork.txt" + } } - ] + } }, "contents": "\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\r", "is_html": false @@ -1709,51 +1646,26 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "HasenundFr�sche.txt" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "HasenundFr�sche.txt" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 4437, - "end": 4472 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4498, - "end": 4517 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4537, - "end": 4582 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false diff --git a/tests/legacy/024.txt b/tests/legacy/024.txt index 7badfaf..9d48c59 100644 --- a/tests/legacy/024.txt +++ b/tests/legacy/024.txt @@ -110,137 +110,135 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 37, - "second": 39, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "=====================_715429112==_.REL", + "type": "text/html" } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "text/html", - "boundary": "=====================_715429112==_.REL" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 37, + "second": 39, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 508 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "message_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 508 + } + ], "html_body": [ 0 ], @@ -259,36 +257,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 565, - "end": 599 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 625, - "end": 644 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": true @@ -297,61 +277,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48eb6.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa48eb6.png" - } + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48eb6.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1942, - "end": 1975 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 1986, - "end": 2041 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2067, - "end": 2076 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2096, - "end": 2130 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa48eb6.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1685,61 +1633,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48ec0.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa48ec0.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48ec0.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 4003, - "end": 4036 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 4047, - "end": 4102 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4128, - "end": 4137 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4157, - "end": 4191 + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa48ec0.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/025.txt b/tests/legacy/025.txt index abbd57a..3e34905 100644 --- a/tests/legacy/025.txt +++ b/tests/legacy/025.txt @@ -172,136 +172,134 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715462801==_" } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715462801==_" - } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 38, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 38, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } - ] + }, + "message_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Priority": { + "Text": "2 (High)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 482 + } + ], "html_body": [ 1 ], @@ -325,62 +323,33 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "text/html", - "boundary": "=====================_715462801==_.REL" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "=====================_715462801==_.REL", + "type": "text/html" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 535, - "end": 628 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 685, - "end": 719 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 745, - "end": 764 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "\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", "is_html": true @@ -389,61 +358,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa51367.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa51367.png" - } + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa51367.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 2053, - "end": 2086 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 2097, - "end": 2152 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2178, - "end": 2187 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2207, - "end": 2241 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa51367.png" + } } - ] + } }, "contents": [ 137, @@ -1777,61 +1714,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa51371.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa51371.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa51371.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 4114, - "end": 4147 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 4158, - "end": 4213 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4239, - "end": 4248 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4268, - "end": 4302 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa51371.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" + } }, "contents": [ 137, @@ -3293,51 +3198,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 6393, - "end": 6426 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 6452, - "end": 6461 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 6481, - "end": 6519 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -4671,51 +4551,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 8388, - "end": 8422 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 8448, - "end": 8457 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 8477, - "end": 8516 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/026.txt b/tests/legacy/026.txt index 3c3b375..6b4e804 100644 --- a/tests/legacy/026.txt +++ b/tests/legacy/026.txt @@ -85,126 +85,124 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 59, - "second": 31, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716740438==_" - } + "headers_rfc": { + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "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" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716740438==_" } } }, - "other_values": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 59, + "second": 31, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 266 - }, - { - "name": { - "Rfc": "from" - }, - "start": 271, - "end": 308 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 316, - "end": 361 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 374, - "end": 380 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 393, - "end": 460 - } - ] + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Rfc": "date" + }, + "start": 175, + "end": 209 + }, + { + "name": { + "Rfc": "to" + }, + "start": 212, + "end": 266 + }, + { + "name": { + "Rfc": "from" + }, + "start": 271, + "end": 308 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 316, + "end": 361 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 374, + "end": 380 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 393, + "end": 460 + } + ], "html_body": [ 0 ], @@ -223,36 +221,18 @@ Birds of a feather flock together. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 513, - "end": 548 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 574, - "end": 593 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false @@ -261,53 +241,28 @@ Birds of a feather flock together. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "x-mac-type": "54455854", - "name": "HasenundFr�sche.txt", - "x-mac-creator": "74747874" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "HasenundFr�sche.txt" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "HasenundFr�sche.txt" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1457, - "end": 1549 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1575, - "end": 1588 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1608, - "end": 1653 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "x-mac-creator": "74747874", + "name": "HasenundFr�sche.txt", + "x-mac-type": "54455854" + } } - ] + }, + "content_transfer_encoding": { + "Text": "x-uuencode" + } }, "contents": "\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", "is_html": true @@ -425,46 +376,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_id": { + "Text": "823504223@17052000-0f8d" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } - }, - "content_id": { - "Text": "823504223@17052000-0f8d" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3495, - "end": 3530 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3556, - "end": 3565 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3576, - "end": 3604 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1798,46 +1724,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } - }, - "content_id": { - "Text": "823504223@17052000-0f94" - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5482, - "end": 5516 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5542, - "end": 5551 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 5562, - "end": 5590 - } - ] + "content_id": { + "Text": "823504223@17052000-0f94" + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/029.txt b/tests/legacy/029.txt index 49c7fa1..9379fd0 100644 --- a/tests/legacy/029.txt +++ b/tests/legacy/029.txt @@ -28,146 +28,144 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "392362D8.B650789F@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 26, - "second": 16, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "headers_rfc": { + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "message_id": { + "Text": "392362D8.B650789F@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Priority": { - "Text": "1 (Highest)" - }, - "X-Accept-Language": { - "Text": "en" - } + "mime_version": { + "Text": "1.0" }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 305, - "end": 319 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 332, - "end": 363 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 389, - "end": 396 + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 26, + "second": 16, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + } }, + "headers_other": { + "X-Priority": { + "Text": "1 (Highest)" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 305, + "end": 319 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 332, + "end": 363 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 389, + "end": 396 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/030.txt b/tests/legacy/030.txt index 54469dc..4037d58 100644 --- a/tests/legacy/030.txt +++ b/tests/legacy/030.txt @@ -112,126 +112,124 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "message_id": { + "Text": "3923635B.85C58444@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------0BBC657DDC74A0B8454627FD" } - }, - "message_id": { - "Text": "3923635B.85C58444@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 28, - "second": 27, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------0BBC657DDC74A0B8454627FD" - } - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "mime_version": { - "Text": "1.0" } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } - ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 28, + "second": 27, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0, 1, @@ -257,36 +255,18 @@ Slow but steady wins the race. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 508 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 534, - "end": 541 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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", "is_html": false @@ -295,51 +275,26 @@ Slow but steady wins the race. { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1365, - "end": 1400 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1426, - "end": 1435 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1455, - "end": 1491 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -1673,51 +1628,26 @@ Slow but steady wins the race. { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3364, - "end": 3400 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3426, - "end": 3435 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3455, - "end": 3492 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -3024,52 +2954,27 @@ Slow but steady wins the race. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii", - "name": "hareandtoroise.txt" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii", + "name": "hareandtoroise.txt" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "hareandtoroise.txt" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5329, - "end": 5389 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5415, - "end": 5422 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5442, - "end": 5484 + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "hareandtoroise.txt" + } } - ] + } }, "contents": "\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", "is_html": false diff --git a/tests/legacy/031.txt b/tests/legacy/031.txt index bf367e8..7a08a0b 100644 --- a/tests/legacy/031.txt +++ b/tests/legacy/031.txt @@ -97,104 +97,102 @@ Z3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-952513540-958744548=:8452" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com" + }, + "subject": { + "Text": "Test message from PINE" + }, + "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" - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 9, - "minute": 55, - "second": 48, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from PINE" - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 124 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 132, - "end": 157 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 168, - "end": 232 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 245, - "end": 251 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 264, - "end": 332 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" } - ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 9, + "minute": 55, + "second": 48, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "date" + }, + "start": 5, + "end": 45 + }, + { + "name": { + "Rfc": "from" + }, + "start": 50, + "end": 91 + }, + { + "name": { + "Rfc": "to" + }, + "start": 94, + "end": 124 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 132, + "end": 157 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 168, + "end": 232 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 245, + "end": 251 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 264, + "end": 332 + } + ], "html_body": [ 0 ], @@ -213,26 +211,15 @@ Z3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "US-ASCII" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "US-ASCII" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 608, - "end": 639 - } - ] + } }, "contents": "This is a test message from PINE MUA.\r\n\r\n\r", "is_html": false @@ -241,71 +228,32 @@ Z3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" - }, - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_description": { - "Text": "A PNG graphic file" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "redball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" + }, + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 738, - "end": 785 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 811, - "end": 820 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 831, - "end": 888 - }, - { - "name": { - "Rfc": "content_description" - }, - "start": 908, - "end": 929 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 949, - "end": 986 + "content_description": { + "Text": "A PNG graphic file" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" + } } - ] + } }, "contents": [ 137, @@ -1767,71 +1715,32 @@ Z3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "blueball.png" } - }, - "content_id": { - "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" - }, - "content_description": { - "Text": "A PNG graphic file" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "BASE64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3048, - "end": 3096 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3122, - "end": 3131 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3142, - "end": 3199 - }, - { - "name": { - "Rfc": "content_description" - }, - "start": 3219, - "end": 3240 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3260, - "end": 3298 + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_description": { + "Text": "A PNG graphic file" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/032.txt b/tests/legacy/032.txt index d0c2393..0c9dbc1 100644 --- a/tests/legacy/032.txt +++ b/tests/legacy/032.txt @@ -134,126 +134,124 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 8, - "second": 29, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "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" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "39235EAD.E48E2160@example.com" + "headers_rfc": { + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "message_id": { + "Text": "39235EAD.E48E2160@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------C78F594988075E36AE03C243" + } } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } - ] + }, + "mime_version": { + "Text": "1.0" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 8, + "second": 29, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 2, 3, @@ -275,61 +273,32 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "------------D74AE2393FB01D1B284AE257" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "------------D74AE2393FB01D1B284AE257" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 552 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 609, - "end": 642 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 668, - "end": 687 - } - ] + } }, "contents": "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", "is_html": false @@ -338,36 +307,18 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" - } + "content_transfer_encoding": { + "Text": "7bit" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1542, - "end": 1572 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1598, - "end": 1605 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" + } } - ] + } }, "contents": "\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\r", "is_html": true @@ -376,51 +327,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 2655, - "end": 2691 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2717, - "end": 2726 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2746, - "end": 2783 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + } }, "contents": [ 137, @@ -1727,51 +1653,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 4620, - "end": 4655 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4681, - "end": 4690 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4710, - "end": 4746 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/033.txt b/tests/legacy/033.txt index 9cc832f..9bbfc59 100644 --- a/tests/legacy/033.txt +++ b/tests/legacy/033.txt @@ -34,146 +34,144 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "message_id": { - "Text": "392363E1.2AC47AB3@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 30, - "second": 41, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" + "headers_rfc": { + "message_id": { + "Text": "392363E1.2AC47AB3@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - }, - "X-Priority": { - "Text": "5 (Lowest)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 305, - "end": 318 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 331, - "end": 359 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 385, - "end": 404 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } } - ] + }, + "mime_version": { + "Text": "1.0" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 30, + "second": 41, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Priority": { + "Text": "5 (Lowest)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 305, + "end": 318 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 331, + "end": 359 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 385, + "end": 404 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/034.txt b/tests/legacy/034.txt index 627d2c9..683eb16 100644 --- a/tests/legacy/034.txt +++ b/tests/legacy/034.txt @@ -27,136 +27,134 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-7" - } - } - }, - "to": { - "Address": { - "name": "Heinz M+APw-ller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Fr+APY-sche" - }, - "message_id": { - "Text": "39236497.12FA2A89@example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 33, - "second": 43, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_transfer_encoding": { - "Text": "7bit" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-7" } } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 33, + "second": 43, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 253 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 261, - "end": 293 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 306, - "end": 334 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 360, - "end": 367 + "to": { + "Address": { + "name": "Heinz M+APw-ller", + "address": "mueller@example.com" } - ] + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "39236497.12FA2A89@example.com" + }, + "subject": { + "Text": "Die Hasen und die Fr+APY-sche" + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 253 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 261, + "end": 293 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 306, + "end": 334 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 360, + "end": 367 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/035.txt b/tests/legacy/035.txt index 8c415a5..66f677a 100644 --- a/tests/legacy/035.txt +++ b/tests/legacy/035.txt @@ -213,126 +213,124 @@ YII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 13, - "second": 9, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "39235FC5.276CCE00@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------A1E83A41894D3755390B838A" - } - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "39235FC5.276CCE00@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------A1E83A41894D3755390B838A" } } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 13, + "second": 9, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 266 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 274, - "end": 346 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 359, - "end": 428 + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } - ] + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 266 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 274, + "end": 346 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 359, + "end": 428 + } + ], "html_body": [ 3, 6, @@ -360,61 +358,32 @@ YII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "------------F03F94BA73D3B9E8C1B94D92" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "------------F03F94BA73D3B9E8C1B94D92" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 529, - "end": 604 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 661, - "end": 694 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 720, - "end": 739 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "[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", "is_html": false @@ -422,61 +391,32 @@ YII= }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "------------C02FA3D0A04E95F295FB25EB" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "------------C02FA3D0A04E95F295FB25EB" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1620, - "end": 1691 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1748, - "end": 1778 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1804, - "end": 1811 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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\r", "is_html": true @@ -485,58 +425,26 @@ YII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "part1.39235FC5.E71D8178@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png" - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "C:TEMPnsmailEG.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "C:TEMPnsmailEG.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 2990, - "end": 3002 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3013, - "end": 3053 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3079, - "end": 3088 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3108, - "end": 3150 + "content_id": { + "Text": "part1.39235FC5.E71D8178@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png" } - ] + } }, "contents": [ 137, @@ -1870,58 +1778,26 @@ YII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png" - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "part2.39235FC5.E71D8178@example.com" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "C:TEMPnsmail39.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png" + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "C:TEMPnsmail39.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5023, - "end": 5035 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 5046, - "end": 5086 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5112, - "end": 5121 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5141, - "end": 5183 - } - ] + "content_id": { + "Text": "part2.39235FC5.E71D8178@example.com" + } }, "contents": [ 137, @@ -3383,51 +3259,26 @@ YII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 7320, - "end": 7354 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 7380, - "end": 7389 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 7409, - "end": 7444 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "redball.png" + } } - ] + } }, "contents": [ 137, @@ -4889,51 +4740,26 @@ YII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 9493, - "end": 9529 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 9555, - "end": 9564 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 9584, - "end": 9621 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/036.txt b/tests/legacy/036.txt index 05a3b60..21f26b7 100644 --- a/tests/legacy/036.txt +++ b/tests/legacy/036.txt @@ -27,114 +27,112 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "content_transfer_encoding": { - "Text": "QUOTED-PRINTABLE" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 10, - "minute": 18, - "second": 3, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" + "headers_rfc": { + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 159 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 167, - "end": 214 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 225, - "end": 289 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 302, - "end": 308 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 321, - "end": 354 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 380, - "end": 399 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 10, + "minute": 18, + "second": 3, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } + }, + "message_id": { + "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "content_transfer_encoding": { + "Text": "QUOTED-PRINTABLE" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "date" + }, + "start": 5, + "end": 45 + }, + { + "name": { + "Rfc": "from" + }, + "start": 50, + "end": 91 + }, + { + "name": { + "Rfc": "to" + }, + "start": 94, + "end": 159 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 167, + "end": 214 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 225, + "end": 289 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 302, + "end": 308 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 321, + "end": 354 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 380, + "end": 399 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/037.txt b/tests/legacy/037.txt index 34fbf31..7b860cd 100644 --- a/tests/legacy/037.txt +++ b/tests/legacy/037.txt @@ -52,126 +52,124 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------E7889DDF0F75D34163841C59" - } - } - }, - "message_id": { - "Text": "392366A7.21929EA7@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 42, - "second": 31, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 42, + "second": 31, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "message_id": { + "Text": "392366A7.21929EA7@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------E7889DDF0F75D34163841C59" } } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - } - }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0, 1 @@ -189,36 +187,18 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 508 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 534, - "end": 541 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": " \r", "is_html": false @@ -227,51 +207,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 599, - "end": 634 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 660, - "end": 669 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 689, - "end": 725 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/038.txt b/tests/legacy/038.txt index 15d5be8..778ad0b 100644 --- a/tests/legacy/038.txt +++ b/tests/legacy/038.txt @@ -18,136 +18,134 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "message_id": { - "Text": "3923625B.59F0C3AC@example.com" - }, - "content_transfer_encoding": { - "Text": "7bit" - }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 24, - "second": 11, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 24, + "second": 11, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 338 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 364, - "end": 371 + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } - ] + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "3923625B.59F0C3AC@example.com" + }, + "mime_version": { + "Text": "1.0" + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 338 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 364, + "end": 371 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/039.txt b/tests/legacy/039.txt index a04ed9d..970f85d 100644 --- a/tests/legacy/039.txt +++ b/tests/legacy/039.txt @@ -172,126 +172,124 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 18, - "second": 27, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------B7133A01A6B323BF00DBC9A7" - } - } - }, - "message_id": { - "Text": "39236103.FFE674FC@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "headers_rfc": { + "message_id": { + "Text": "39236103.FFE674FC@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "mime_version": { + "Text": "1.0" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 18, + "second": 27, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 331 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 344, - "end": 413 + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } - ] + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------B7133A01A6B323BF00DBC9A7" + } + } + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 277 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 285, + "end": 331 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 344, + "end": 413 + } + ], "html_body": [ 1, 4, @@ -319,61 +317,32 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "------------8E6A06810565BCAB5E1F7D97" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "------------8E6A06810565BCAB5E1F7D97" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 514, - "end": 585 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 642, - "end": 672 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 698, - "end": 705 - } - ] + } }, "contents": "\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\r", "is_html": true @@ -382,58 +351,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "part1.39236103.1B697A54@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "C:TEMPnsmailV0.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1896, - "end": 1908 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 1919, - "end": 1959 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1985, - "end": 1994 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2014, - "end": 2056 + "content_id": { + "Text": "part1.39236103.1B697A54@example.com" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "C:TEMPnsmailV0.png" + } } - ] + } }, "contents": [ 137, @@ -1767,58 +1704,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "C:TEMPnsmailNM.png" - } + "content_id": { + "Text": "part2.39236103.1B697A54@example.com" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "C:TEMPnsmailNM.png" } - }, - "content_id": { - "Text": "part2.39236103.1B697A54@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png" - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3929, - "end": 3941 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3952, - "end": 3992 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4018, - "end": 4027 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4047, - "end": 4089 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png" } - ] + } }, "contents": [ 137, @@ -3280,51 +3185,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 6182, - "end": 6218 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 6244, - "end": 6253 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 6273, - "end": 6310 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + } }, "contents": [ 137, @@ -4631,51 +4511,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 8147, - "end": 8182 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 8208, - "end": 8217 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 8237, - "end": 8273 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/040.txt b/tests/legacy/040.txt index 0d69814..96ac9c9 100644 --- a/tests/legacy/040.txt +++ b/tests/legacy/040.txt @@ -29,136 +29,134 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 41, - "second": 7, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "39236653.CAA8A090@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "39236653.CAA8A090@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 332 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 345, - "end": 378 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 404, - "end": 423 + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 41, + "second": 7, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 277 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 285, + "end": 332 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 345, + "end": 378 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 404, + "end": 423 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/041.txt b/tests/legacy/041.txt index 4a13984..8fdfcfb 100644 --- a/tests/legacy/041.txt +++ b/tests/legacy/041.txt @@ -58,104 +58,102 @@ vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-170444605-958746196=:8452" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "subject": { - "Text": "PNG graphic" - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 10, - "minute": 23, - "second": 16, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "mime_version": { - "Text": "1.0" + "headers_rfc": { + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 150 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 158, - "end": 172 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 183, - "end": 247 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 260, - "end": 266 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 279, - "end": 347 + "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" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 10, + "minute": 23, + "second": 16, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } + }, + "subject": { + "Text": "PNG graphic" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "date" + }, + "start": 5, + "end": 45 + }, + { + "name": { + "Rfc": "from" + }, + "start": 50, + "end": 91 + }, + { + "name": { + "Rfc": "to" + }, + "start": 94, + "end": 150 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 158, + "end": 172 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 183, + "end": 247 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 260, + "end": 266 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 279, + "end": 347 + } + ], "html_body": [ 0 ], @@ -171,26 +169,15 @@ vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "US-ASCII" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "US-ASCII" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 623, - "end": 654 - } - ] + } }, "contents": "\r", "is_html": false @@ -199,71 +186,32 @@ vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "redball.png" - } - } - }, - "content_id": { - "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" - }, - "content_description": { - "Text": "red ball" - }, - "content_transfer_encoding": { - "Text": "BASE64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 712, - "end": 759 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 785, - "end": 794 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 805, - "end": 862 - }, - { - "name": { - "Rfc": "content_description" - }, - "start": 882, - "end": 893 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 913, - "end": 950 + "content_description": { + "Text": "red ball" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" + }, + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "redball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/042.txt b/tests/legacy/042.txt index 48278f4..8ec4378 100644 --- a/tests/legacy/042.txt +++ b/tests/legacy/042.txt @@ -59,126 +59,124 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "3923686C.99FB5E36@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": "------------77060D866A66DC8D0921E051" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 50, - "second": 4, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 50, + "second": 4, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------77060D866A66DC8D0921E051" } } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "message_id": { + "Text": "3923686C.99FB5E36@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } - ] + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0 ], @@ -194,36 +192,18 @@ Birds of a feather flock together. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 508 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 534, - "end": 541 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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", "is_html": false @@ -232,52 +212,27 @@ Birds of a feather flock together. { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "farmerandstork.txt" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "name": "farmerandstork.txt", - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii", + "name": "farmerandstork.txt" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1365, - "end": 1425 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1451, - "end": 1458 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1478, - "end": 1520 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "farmerandstork.txt" + } } - ] + }, + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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\r", "is_html": false diff --git a/tests/legacy/043.txt b/tests/legacy/043.txt index 16211c5..fcd8c4e 100644 --- a/tests/legacy/043.txt +++ b/tests/legacy/043.txt @@ -62,126 +62,124 @@ als wir." ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "------------9D454F23DA86BCD63FA3805F" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 22, - "minute": 47, - "second": 43, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "392359CF.DFF4527@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "392359CF.DFF4527@example.com" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 22, + "minute": 47, + "second": 43, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 44 - }, - { - "name": { - "Rfc": "date" - }, - "start": 49, - "end": 83 - }, - { - "name": { - "Rfc": "from" - }, - "start": 88, - "end": 125 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 134, - "end": 164 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 182, - "end": 187 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 200, - "end": 206 - }, - { - "name": { - "Rfc": "to" - }, - "start": 209, - "end": 265 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 273, - "end": 348 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 361, - "end": 436 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } - ] + }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "------------9D454F23DA86BCD63FA3805F" + } + } + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 44 + }, + { + "name": { + "Rfc": "date" + }, + "start": 49, + "end": 83 + }, + { + "name": { + "Rfc": "from" + }, + "start": 88, + "end": 125 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 134, + "end": 164 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 182, + "end": 187 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 200, + "end": 206 + }, + { + "name": { + "Rfc": "to" + }, + "start": 209, + "end": 265 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 273, + "end": 348 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 361, + "end": 436 + } + ], "html_body": [ 1 ], @@ -192,36 +190,18 @@ als wir." { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 493, - "end": 526 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 552, - "end": 571 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + } }, "contents": "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", "is_html": false @@ -230,36 +210,18 @@ als wir." { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } - } - }, - "content_transfer_encoding": { - "Text": "7bit" - } + "content_transfer_encoding": { + "Text": "7bit" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1426, - "end": 1456 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1482, - "end": 1489 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" + } } - ] + } }, "contents": "\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\r", "is_html": true diff --git a/tests/legacy/044.txt b/tests/legacy/044.txt index 2dcca3c..e945509 100644 --- a/tests/legacy/044.txt +++ b/tests/legacy/044.txt @@ -138,126 +138,124 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------A1FCDEE154E03D875E5D6779" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 6, - "second": 4, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "39235E1C.1DC7EA90@example.com" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" + "headers_rfc": { + "message_id": { + "Text": "39235E1C.1DC7EA90@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 6, + "second": 4, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------A1FCDEE154E03D875E5D6779" + } + } + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0, 1, @@ -285,36 +283,18 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 510 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 536, - "end": 555 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "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", "is_html": false @@ -323,51 +303,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "redball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "redball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1410, - "end": 1444 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1470, - "end": 1479 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1499, - "end": 1534 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1829,51 +1784,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3583, - "end": 3619 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3645, - "end": 3654 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3674, - "end": 3711 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } } - ] + } }, "contents": [ 137, @@ -3180,51 +3110,26 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5548, - "end": 5583 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5609, - "end": 5618 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5638, - "end": 5674 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" + } } - ] + } }, "contents": [ 137, diff --git a/tests/legacy/045.txt b/tests/legacy/045.txt index b27193e..dd13df6 100644 --- a/tests/legacy/045.txt +++ b/tests/legacy/045.txt @@ -43,110 +43,108 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com" - }, - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "blow@example.com" - }, - { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - ] - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 10, - "minute": 26, - "second": 12, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "-1463757054-891160829-958746372=:8452" } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-891160829-958746372=:8452" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, - "offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 185 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 193, - "end": 240 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 251, - "end": 315 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 328, - "end": 334 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 347, - "end": 415 + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + }, + "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 + } + }, + "message_id": { + "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com" + }, + "to": { + "AddressList": [ + { + "name": "Joe Blow", + "address": "blow@example.com" + }, + { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "date" + }, + "start": 5, + "end": 45 + }, + { + "name": { + "Rfc": "from" + }, + "start": 50, + "end": 91 + }, + { + "name": { + "Rfc": "to" + }, + "start": 94, + "end": 185 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 193, + "end": 240 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 251, + "end": 315 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 328, + "end": 334 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 347, + "end": 415 + } + ], "html_body": [ 0 ], @@ -162,26 +160,15 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "US-ASCII" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "US-ASCII" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 691, - "end": 722 - } - ] + } }, "contents": "\r", "is_html": false @@ -190,72 +177,33 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= { "Text": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "HasenundFrösche.txt" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1", + "name": "HasenundFrösche.txt" } - }, - "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_transfer_encoding": { - "Text": "BASE64" - }, - "content_description": { - "Text": "Short story in German" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 780, - "end": 856 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 882, - "end": 891 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 902, - "end": 959 - }, - { - "name": { - "Rfc": "content_description" - }, - "start": 979, - "end": 1003 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1023, - "end": 1083 + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "HasenundFrösche.txt" + } } - ] + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com" + }, + "content_description": { + "Text": "Short story in German" + } }, "contents": "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", "is_html": false diff --git a/tests/legacy/046.txt b/tests/legacy/046.txt index e1fa7e0..6d0c2ba 100644 --- a/tests/legacy/046.txt +++ b/tests/legacy/046.txt @@ -33,136 +33,134 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "message_id": { - "Text": "3923561C.B7078DEF@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 22, - "minute": 31, - "second": 57, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "mime_version": { - "Text": "1.0" + "headers_rfc": { + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "other_values": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 22, + "minute": 31, + "second": 57, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 360 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 373, - "end": 406 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 432, - "end": 451 + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "3923561C.B7078DEF@example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 277 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 285, + "end": 360 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 373, + "end": 406 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 432, + "end": 451 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/047.txt b/tests/legacy/047.txt index 5228092..7e074d8 100644 --- a/tests/legacy/047.txt +++ b/tests/legacy/047.txt @@ -61,126 +61,124 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "392367BC.3D075C95@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 47, - "second": 8, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------CA611088711119FBDB3473B4" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 47, + "second": 8, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "message_id": { + "Text": "392367BC.3D075C95@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } - ] + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------CA611088711119FBDB3473B4" + } + } + } }, + "headers_other": { + "X-Accept-Language": { + "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0 ], @@ -196,36 +194,18 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 508 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 534, - "end": 541 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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", "is_html": false @@ -234,52 +214,27 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "HasenundFrösche.txt" - } - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "name": "HasenundFrösche.txt", - "charset": "iso-8859-1" - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1", + "name": "HasenundFrösche.txt" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1365, - "end": 1449 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1475, - "end": 1494 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1514, - "end": 1578 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "HasenundFrösche.txt" + } } - ] + } }, "contents": "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", "is_html": false diff --git a/tests/legacy/048.txt b/tests/legacy/048.txt index 6ba55f2..bbc1132 100644 --- a/tests/legacy/048.txt +++ b/tests/legacy/048.txt @@ -156,126 +156,124 @@ end ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "message_id": { - "Text": "3923670C.67D83A99@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@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": "------------177483472E7788F4AD46AB1A" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 44, - "second": 12, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 44, + "second": 12, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------177483472E7788F4AD46AB1A" } } }, - "other_values": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "3923670C.67D83A99@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } - ] + } }, + "headers_other": { + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 45 + }, + { + "name": { + "Rfc": "date" + }, + "start": 50, + "end": 84 + }, + { + "name": { + "Rfc": "from" + }, + "start": 89, + "end": 126 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 135, + "end": 165 + }, + { + "name": { + "Other": "X-Accept-Language" + }, + "start": 183, + "end": 188 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 201, + "end": 207 + }, + { + "name": { + "Rfc": "to" + }, + "start": 210, + "end": 240 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 248, + "end": 294 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 307, + "end": 376 + } + ], "html_body": [ 0, 1, @@ -303,36 +301,18 @@ end { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 477, - "end": 508 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 534, - "end": 541 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "\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", "is_html": false @@ -341,51 +321,26 @@ end { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "redball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1365, - "end": 1399 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1425, - "end": 1438 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1458, - "end": 1493 + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "redball.png" + } } - ] + } }, "contents": [ 98, @@ -2462,51 +2417,26 @@ end { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3617, - "end": 3653 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3679, - "end": 3692 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3712, - "end": 3749 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + } }, "contents": [ 98, @@ -4365,51 +4295,26 @@ end { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5655, - "end": 5690 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 5716, - "end": 5729 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 5749, - "end": 5785 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 98, diff --git a/tests/legacy/049.txt b/tests/legacy/049.txt index 44d551b..9ddca14 100644 --- a/tests/legacy/049.txt +++ b/tests/legacy/049.txt @@ -132,130 +132,128 @@ end ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 58, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "other_values": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 236, - "end": 249 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 267, - "end": 276 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 285, - "end": 338 - }, - { - "name": { - "Other": "Importance" - }, - "start": 349, - "end": 358 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 368, - "end": 416 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 58, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + } }, + "headers_other": { + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "Importance": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 76 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 84, + "end": 125 + }, + { + "name": { + "Rfc": "date" + }, + "start": 130, + "end": 164 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 175, + "end": 225 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 236, + "end": 249 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 267, + "end": 276 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 285, + "end": 338 + }, + { + "name": { + "Other": "Importance" + }, + "start": 349, + "end": 358 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 368, + "end": 416 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/050.txt b/tests/legacy/050.txt index 8a4c3a9..d303841 100644 --- a/tests/legacy/050.txt +++ b/tests/legacy/050.txt @@ -110,137 +110,135 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "text/html", - "boundary": "=====================_715546120==_.REL" - } - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 39, - "second": 36, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "text/html", + "boundary": "=====================_715546120==_.REL" } } }, - "other_values": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 508 + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 39, + "second": 36, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } - ] + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 508 + } + ], "html_body": [ 0 ], @@ -259,36 +257,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 565, - "end": 599 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 625, - "end": 644 - } - ] + } }, "contents": "\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", "is_html": true @@ -297,61 +277,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa658b6.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa658b6.png" - } + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa658b6.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1942, - "end": 1975 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 1986, - "end": 2041 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2067, - "end": 2076 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2096, - "end": 2130 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa658b6.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, @@ -1685,61 +1633,29 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa658c0.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa658c0.png" - } + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa658c0.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 4003, - "end": 4036 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 4047, - "end": 4102 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 4128, - "end": 4137 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 4157, - "end": 4191 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa658c0.png" + } } - ] + }, + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" + } }, "contents": [ 137, diff --git a/tests/legacy/051.txt b/tests/legacy/051.txt index b9bf4fa..204eeb2 100644 --- a/tests/legacy/051.txt +++ b/tests/legacy/051.txt @@ -162,136 +162,134 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com" - }, - "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" - } - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 39, - "second": 5, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715515186==_" - } + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "message_id": { + "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715515186==_" } } }, - "other_values": { - "X-Priority": { - "Text": "2 (High)" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 39, + "second": 5, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } - ] + } }, + "headers_other": { + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "message_id" + }, + "start": 11, + "end": 64 + }, + { + "name": { + "Other": "X-Sender" + }, + "start": 73, + "end": 113 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 122, + "end": 170 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 181, + "end": 192 + }, + { + "name": { + "Rfc": "date" + }, + "start": 197, + "end": 231 + }, + { + "name": { + "Rfc": "to" + }, + "start": 234, + "end": 288 + }, + { + "name": { + "Rfc": "from" + }, + "start": 293, + "end": 330 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 338, + "end": 383 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 396, + "end": 402 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 415, + "end": 482 + } + ], "html_body": [ 1 ], @@ -315,62 +313,33 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "text/plain", - "boundary": "=====================_715515186==_.REL" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "text/plain", + "boundary": "=====================_715515186==_.REL" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 535, - "end": 629 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 686, - "end": 721 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 747, - "end": 766 - } - ] + } }, "contents": "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", "is_html": false @@ -379,61 +348,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa5e03a.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa5e03a.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa5e03a.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1658, - "end": 1691 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 1702, - "end": 1757 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1783, - "end": 1792 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 1812, - "end": 1846 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa5e03a.png" + } } - ] + }, + "content_id": { + "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" + } }, "contents": [ 137, @@ -1767,61 +1704,29 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa5e044.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa5e044.png" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa5e044.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 3719, - "end": 3752 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 3763, - "end": 3818 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 3844, - "end": 3853 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 3873, - "end": 3907 + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa5e044.png" + } } - ] + }, + "content_id": { + "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3" + } }, "contents": [ 137, @@ -3283,51 +3188,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 5998, - "end": 6031 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 6057, - "end": 6066 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 6086, - "end": 6124 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } } - ] + } }, "contents": [ 137, @@ -4661,51 +4541,26 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 7993, - "end": 8027 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 8053, - "end": 8062 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 8082, - "end": 8121 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } } - ] + }, + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": [ 137, diff --git a/tests/legacy/052.txt b/tests/legacy/052.txt index 2238ca2..1e47530 100644 --- a/tests/legacy/052.txt +++ b/tests/legacy/052.txt @@ -28,130 +28,128 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz M�ller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 28, - "second": 40, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" + "headers_rfc": { + "to": { + "Address": { + "name": "Heinz M�ller", + "address": "mueller@example.com" } }, - "other_values": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 28, + "second": 40, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 82 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 90, - "end": 141 - }, - { - "name": { - "Rfc": "date" - }, - "start": 146, - "end": 180 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 191, - "end": 241 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 252, - "end": 265 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 283, - "end": 292 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 301, - "end": 354 - }, - { - "name": { - "Other": "Importance" - }, - "start": 365, - "end": 374 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 384, - "end": 432 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } - ] + }, + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" + } }, + "headers_other": { + "Importance": { + "Text": "Normal" + }, + "X-MSMail-Priority": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 82 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 90, + "end": 141 + }, + { + "name": { + "Rfc": "date" + }, + "start": 146, + "end": 180 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 191, + "end": 241 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 252, + "end": 265 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 283, + "end": 292 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 301, + "end": 354 + }, + { + "name": { + "Other": "Importance" + }, + "start": 365, + "end": 374 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 384, + "end": 432 + } + ], "html_body": [ 0 ], diff --git a/tests/legacy/053.txt b/tests/legacy/053.txt index 68823d0..faf7da7 100644 --- a/tests/legacy/053.txt +++ b/tests/legacy/053.txt @@ -33,166 +33,164 @@ als wir."=20 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 27, - "second": 4, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" + "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "other_values": { - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" + } } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 97 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 105, - "end": 177 - }, - { - "name": { - "Rfc": "date" - }, - "start": 182, - "end": 216 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 227, - "end": 277 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 290, - "end": 296 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 309, - "end": 341 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 367, - "end": 386 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 397, - "end": 410 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 428, - "end": 437 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 446, - "end": 499 - }, - { - "name": { - "Other": "Importance" - }, - "start": 510, - "end": 519 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 529, - "end": 577 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } - ] + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 27, + "second": 4, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + } }, + "headers_other": { + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "Importance": { + "Text": "Normal" + }, + "X-MSMail-Priority": { + "Text": "Normal" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 40 + }, + { + "name": { + "Rfc": "to" + }, + "start": 43, + "end": 97 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 105, + "end": 177 + }, + { + "name": { + "Rfc": "date" + }, + "start": 182, + "end": 216 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 227, + "end": 277 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 290, + "end": 296 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 309, + "end": 341 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 367, + "end": 386 + }, + { + "name": { + "Other": "X-Priority" + }, + "start": 397, + "end": 410 + }, + { + "name": { + "Other": "X-MSMail-Priority" + }, + "start": 428, + "end": 437 + }, + { + "name": { + "Other": "X-Mailer" + }, + "start": 446, + "end": 499 + }, + { + "name": { + "Other": "Importance" + }, + "start": 510, + "end": 519 + }, + { + "name": { + "Other": "X-MimeOLE" + }, + "start": 529, + "end": 577 + } + ], "html_body": [ 0 ], diff --git a/tests/malformed/000.txt b/tests/malformed/000.txt index 5a03bd9..2e124fe 100644 --- a/tests/malformed/000.txt +++ b/tests/malformed/000.txt @@ -11,32 +11,67 @@ Content-Type: text/html ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": ":foo" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": ":foo" } } + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 47 + } + ], + "html_body": [ + 0, + 1 + ], + "text_body": [ + 0, + 1 + ], + "parts": [ + { + "Text": { + "contents": "Content-Type: text/plain", + "is_html": false + } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" + { + "Text": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" + } + } }, - "start": 13, - "end": 47 + "contents": "Content-Type: text/html", + "is_html": false + } + } + ], + "structure": { + "List": [ + { + "Part": 0 + }, + { + "Part": 1 } ] }, - "structure": { - "List": [] - }, "offset_header": 0, "offset_body": 48, - "offset_end": 160 + "offset_end": 159 } \ No newline at end of file diff --git a/tests/malformed/001.txt b/tests/malformed/001.txt index 2e1f3fb..3e3b545 100644 --- a/tests/malformed/001.txt +++ b/tests/malformed/001.txt @@ -11,28 +11,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "ab" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "ab" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 45 + } + ], "html_body": [ 1 ], @@ -42,26 +40,15 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 64, - "end": 95 - } - ] + } } }, { diff --git a/tests/malformed/002.txt b/tests/malformed/002.txt index f2cc4c0..1f0072b 100644 --- a/tests/malformed/002.txt +++ b/tests/malformed/002.txt @@ -4,28 +4,26 @@ body ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "ab" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "ab" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 45 + } + ], "attachments": [ { "Attachment": 0 diff --git a/tests/malformed/003.txt b/tests/malformed/003.txt index a59b7a6..d5e01fa 100644 --- a/tests/malformed/003.txt +++ b/tests/malformed/003.txt @@ -10,28 +10,26 @@ body ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "attachments": [ { "Attachment": 1 @@ -40,48 +38,26 @@ body "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 93 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 111, - "end": 123 - } - ] + } }, "contents": "body\n", "is_html": false diff --git a/tests/malformed/004.txt b/tests/malformed/004.txt index 137204a..f8859da 100644 --- a/tests/malformed/004.txt +++ b/tests/malformed/004.txt @@ -10,28 +10,26 @@ body ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "attachments": [ { "Attachment": 0 diff --git a/tests/malformed/005.txt b/tests/malformed/005.txt index 4d36628..805851d 100644 --- a/tests/malformed/005.txt +++ b/tests/malformed/005.txt @@ -14,28 +14,26 @@ body2 --a---- ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a--" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a--" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 46 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 46 + } + ], "html_body": [ 1 ], @@ -45,48 +43,26 @@ body2 "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a----" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a----" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 66, - "end": 101 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 123, - "end": 135 - } - ] + } }, "contents": "body", "is_html": false diff --git a/tests/malformed/006.txt b/tests/malformed/006.txt index 6fe611d..dc260ae 100644 --- a/tests/malformed/006.txt +++ b/tests/malformed/006.txt @@ -10,28 +10,26 @@ body ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "attachments": [ { "Attachment": 1 @@ -40,48 +38,26 @@ body "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "ab" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "ab" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 94 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 113, - "end": 125 - } - ] + } }, "contents": "body\n", "is_html": false diff --git a/tests/malformed/007.txt b/tests/malformed/007.txt index 1deaf2c..dfb124e 100644 --- a/tests/malformed/007.txt +++ b/tests/malformed/007.txt @@ -12,28 +12,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "attachments": [ { "Attachment": 1 @@ -42,36 +40,18 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "ab" - } + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "ab" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 94 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 107, - "end": 112 - } - ] + } } }, { diff --git a/tests/malformed/008.txt b/tests/malformed/008.txt index 6f5067d..dca2e5c 100644 --- a/tests/malformed/008.txt +++ b/tests/malformed/008.txt @@ -14,28 +14,26 @@ body2 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "ab" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "ab" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 45 + } + ], "attachments": [ { "Attachment": 1 @@ -44,48 +42,26 @@ body2 "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "a" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "a" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 64, - "end": 95 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 113, - "end": 125 - } - ] + } }, "contents": "body\n--ab\nContent-Type: text/html\n\nbody2\n", "is_html": false diff --git a/tests/malformed/009.txt b/tests/malformed/009.txt index 1887dfb..c8b294b 100644 --- a/tests/malformed/009.txt +++ b/tests/malformed/009.txt @@ -18,28 +18,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "html_body": [ 1 ], @@ -54,48 +52,26 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 93 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 111, - "end": 123 - } - ] + } }, "contents": "1", "is_html": false @@ -104,23 +80,12 @@ Content-Type: text/plain { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 143, - "end": 155 - } - ] + } }, "contents": "22\n--1\nContent-Type: text/plain\n\n333\n", "is_html": false diff --git a/tests/malformed/010.txt b/tests/malformed/010.txt index dc5f815..85748fb 100644 --- a/tests/malformed/010.txt +++ b/tests/malformed/010.txt @@ -8,25 +8,23 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 29 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 29 + } + ], "attachments": [ { "Attachment": 1 @@ -35,37 +33,33 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 43, - "end": 59 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 43, + "end": 59 + } + ], "attachments": [ { "Attachment": 1 @@ -74,37 +68,33 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 73, - "end": 85 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 73, + "end": 85 + } + ], "html_body": [ 0 ], diff --git a/tests/malformed/011.txt b/tests/malformed/011.txt index 1887dfb..c8b294b 100644 --- a/tests/malformed/011.txt +++ b/tests/malformed/011.txt @@ -18,28 +18,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "html_body": [ 1 ], @@ -54,48 +52,26 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 93 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 111, - "end": 123 - } - ] + } }, "contents": "1", "is_html": false @@ -104,23 +80,12 @@ Content-Type: text/plain { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 143, - "end": 155 - } - ] + } }, "contents": "22\n--1\nContent-Type: text/plain\n\n333\n", "is_html": false diff --git a/tests/malformed/012.txt b/tests/malformed/012.txt index e09e034..a9c4b2b 100644 --- a/tests/malformed/012.txt +++ b/tests/malformed/012.txt @@ -24,28 +24,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "attachments": [ { "Attachment": 2 @@ -57,70 +55,46 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 93 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 111, - "end": 127 - } - ] + } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 141, - "end": 153 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 141, + "end": 153 + } + ], "html_body": [ 0 ], @@ -145,46 +119,33 @@ Content-Type: text/plain }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 173, - "end": 189 - } - ] + } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 203, - "end": 215 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 203, + "end": 215 + } + ], "attachments": [ { "Attachment": 0 diff --git a/tests/malformed/013.txt b/tests/malformed/013.txt index ba55454..2a5e515 100644 --- a/tests/malformed/013.txt +++ b/tests/malformed/013.txt @@ -33,38 +33,36 @@ hello, world ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } - }, - "mime_version": { - "Text": "1.0" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 57, + "end": 62 + } + ], "html_body": [ 0, 2, @@ -81,23 +79,12 @@ hello, world { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 80, - "end": 92 - } - ] + } }, "contents": "hello, world", "is_html": false @@ -105,58 +92,29 @@ hello, world }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } - }, - "mime_version": { - "Text": "2.0" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 123, - "end": 154 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 167, - "end": 172 - } - ] + "mime_version": { + "Text": "2.0" + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 190, - "end": 202 - } - ] + } }, "contents": "hello, world", "is_html": false @@ -164,58 +122,29 @@ hello, world }, { "Multipart": { - "values": { - "mime_version": { - "Text": "abc" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 233, - "end": 264 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 277, - "end": 282 - } - ] + "mime_version": { + "Text": "abc" + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 300, - "end": 312 - } - ] + } }, "contents": "hello, world", "is_html": false @@ -223,55 +152,26 @@ hello, world }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 343, - "end": 374 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 387, - "end": 388 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 406, - "end": 418 - } - ] + } }, "contents": "hello, world", "is_html": false diff --git a/tests/malformed/014.txt b/tests/malformed/014.txt index 1ff5683..ab2de1a 100644 --- a/tests/malformed/014.txt +++ b/tests/malformed/014.txt @@ -8,28 +8,26 @@ hello, world ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "html_body": [ 0 ], @@ -40,23 +38,12 @@ hello, world { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 62, - "end": 74 - } - ] + } }, "contents": "hello, world", "is_html": false diff --git a/tests/malformed/015.txt b/tests/malformed/015.txt index 0401a85..1591aee 100644 --- a/tests/malformed/015.txt +++ b/tests/malformed/015.txt @@ -26,116 +26,114 @@ invalid ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Test User", - "address": "test@example.org" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "signed", - "attributes": { - "boundary": "=-GNQXLhuj24Pl1aCkk4/d", - "protocol": "application/pgp-signature", - "micalg": "pgp-sha1" - } - } - }, - "to": { - "Address": { - "name": "Another User", - "address": "test2@example.org" - } - }, - "subject": { - "Text": "Hello world" - }, - "message_id": { - "Text": "1.2.3.4@example" - }, - "return_path": { - "Text": "test@example.org" - }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2007, - "month": 5, - "day": 23, - "hour": 4, - "minute": 58, - "second": 8, - "tz_before_gmt": false, - "tz_hour": 3, - "tz_minute": 0 + "headers_rfc": { + "from": { + "Address": { + "name": "Test User", + "address": "test@example.org" + } + }, + "message_id": { + "Text": "1.2.3.4@example" + }, + "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", + "micalg": "pgp-sha1", + "boundary": "=-GNQXLhuj24Pl1aCkk4/d" } } }, - "offsets": [ - { - "name": { - "Rfc": "return_path" - }, - "start": 12, - "end": 32 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 40, - "end": 53 - }, - { - "name": { - "Rfc": "from" - }, - "start": 58, - "end": 88 - }, - { - "name": { - "Rfc": "to" - }, - "start": 91, - "end": 125 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 136, - "end": 155 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 168, - "end": 173 - }, - { - "name": { - "Rfc": "date" - }, - "start": 178, - "end": 211 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 224, - "end": 334 + "subject": { + "Text": "Hello world" + }, + "to": { + "Address": { + "name": "Another User", + "address": "test2@example.org" } - ] + }, + "date": { + "DateTime": { + "year": 2007, + "month": 5, + "day": 23, + "hour": 4, + "minute": 58, + "second": 8, + "tz_before_gmt": false, + "tz_hour": 3, + "tz_minute": 0 + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "return_path" + }, + "start": 12, + "end": 32 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 40, + "end": 53 + }, + { + "name": { + "Rfc": "from" + }, + "start": 58, + "end": 88 + }, + { + "name": { + "Rfc": "to" + }, + "start": 91, + "end": 125 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 136, + "end": 155 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 168, + "end": 173 + }, + { + "name": { + "Rfc": "date" + }, + "start": 178, + "end": 211 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 224, + "end": 334 + } + ], "html_body": [ 0 ], @@ -151,33 +149,15 @@ invalid { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 373, - "end": 385 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 411, - "end": 429 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "There was a day \na happy day\n", "is_html": false @@ -186,26 +166,15 @@ invalid { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "pgp-signature", - "attributes": { - "name": "signature.asc" - } + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "pgp-signature", + "attributes": { + "name": "signature.asc" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 502, - "end": 549 - } - ] + } }, "contents": [ 105, diff --git a/tests/malformed/016.txt b/tests/malformed/016.txt index ab3425f..23f2bf3 100644 --- a/tests/malformed/016.txt +++ b/tests/malformed/016.txt @@ -25,28 +25,26 @@ Content-Type: text/plain ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 125 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 125 + } + ], "html_body": [ 2 ], @@ -61,72 +59,39 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "123456789012345678901234567890123456789012345678901234567890123456789012345678901" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "123456789012345678901234567890123456789012345678901234567890123456789012345678901" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 224, - "end": 335 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "12345678901234567890123456789012345678901234567890123456789012345678901234567890" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "12345678901234567890123456789012345678901234567890123456789012345678901234567890" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 433, - "end": 543 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 640, - "end": 652 - } - ] + } }, "contents": "1\n--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\nContent-Type: text/plain\n\n22\n--123456789012345678901234567890123456789012345678901234567890123456789012345678901\nContent-Type: text/plain\n\n333", "is_html": false @@ -135,23 +100,12 @@ Content-Type: text/plain { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 979, - "end": 991 - } - ] + } }, "contents": "4444\n", "is_html": false diff --git a/tests/rfc/000.txt b/tests/rfc/000.txt index 55bd3ea..9b0e1d4 100644 --- a/tests/rfc/000.txt +++ b/tests/rfc/000.txt @@ -73,94 +73,92 @@ Content-Transfer-Encoding: Quoted-printable ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "date": { - "DateTime": { - "year": 1994, - "month": 10, - "day": 7, - "hour": 16, - "minute": 15, - "second": 5, - "tz_before_gmt": true, - "tz_hour": 7, - "tz_minute": 0 - } - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "A multipart example" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "unique-boundary-1" - } - } - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@nsb.fv.com" + "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "unique-boundary-1" } } }, - "offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 18 - }, - { - "name": { - "Rfc": "from" - }, - "start": 23, - "end": 62 - }, - { - "name": { - "Rfc": "to" - }, - "start": 65, - "end": 95 - }, - { - "name": { - "Rfc": "date" - }, - "start": 100, - "end": 139 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 147, - "end": 168 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 181, - "end": 238 + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@nsb.fv.com" } - ] + }, + "date": { + "DateTime": { + "year": 1994, + "month": 10, + "day": 7, + "hour": 16, + "minute": 15, + "second": 5, + "tz_before_gmt": true, + "tz_hour": 7, + "tz_minute": 0 + } + }, + "subject": { + "Text": "A multipart example" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "mime_version" + }, + "start": 13, + "end": 18 + }, + { + "name": { + "Rfc": "from" + }, + "start": 23, + "end": 62 + }, + { + "name": { + "Rfc": "to" + }, + "start": 65, + "end": 95 + }, + { + "name": { + "Rfc": "date" + }, + "start": 100, + "end": 139 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 147, + "end": 168 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 181, + "end": 238 + } + ], "html_body": [ 0, 1 @@ -193,26 +191,15 @@ Content-Transfer-Encoding: Quoted-printable { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "US-ASCII" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "US-ASCII" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 827, - "end": 857 - } - ] + } }, "contents": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing of body\nparts.\n", "is_html": false @@ -220,58 +207,29 @@ Content-Transfer-Encoding: Quoted-printable }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "parallel", - "attributes": { - "boundary": "unique-boundary-2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "parallel", + "attributes": { + "boundary": "unique-boundary-2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1003, - "end": 1051 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "audio", - "c_subtype": "basic" - } - }, - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "audio", + "c_subtype": "basic" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1085, - "end": 1098 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1124, - "end": 1132 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": "... base64-encoded 8000 Hz single-channel\n mu-law-format audio data goes here ...\n", "is_html": false @@ -280,33 +238,15 @@ Content-Transfer-Encoding: Quoted-printable { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg" - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "content_transfer_encoding": { + "Text": "base64" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1252, - "end": 1264 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1290, - "end": 1298 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg" } - ] + } }, "contents": "... base64-encoded image data goes here ...\n", "is_html": false @@ -315,23 +255,12 @@ Content-Transfer-Encoding: Quoted-printable { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "enriched" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "enriched" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1400, - "end": 1415 - } - ] + } }, "contents": "This is enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n", "is_html": false @@ -339,93 +268,80 @@ Content-Transfer-Encoding: Quoted-printable }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1590, - "end": 1606 - } - ] + } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "ISO-8859-1" - } - } - }, - "from": { - "Address": { - "name": "mailbox in US-ASCII" - } - }, - "to": { - "Address": { - "name": "address in US-ASCII" - } - }, - "content_transfer_encoding": { - "Text": "Quoted-printable" - }, - "subject": { - "Text": "(subject in US-ASCII)" + "headers_rfc": { + "from": { + "Address": { + "name": "mailbox in US-ASCII" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 1612, - "end": 1635 - }, - { - "name": { - "Rfc": "to" - }, - "start": 1638, - "end": 1661 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 1669, - "end": 1692 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 1705, - "end": 1737 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1763, - "end": 1781 + "to": { + "Address": { + "name": "address in US-ASCII" } - ] + }, + "subject": { + "Text": "(subject in US-ASCII)" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "ISO-8859-1" + } + } + }, + "content_transfer_encoding": { + "Text": "Quoted-printable" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 1612, + "end": 1635 + }, + { + "name": { + "Rfc": "to" + }, + "start": 1638, + "end": 1661 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 1669, + "end": 1692 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 1705, + "end": 1737 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 1763, + "end": 1781 + } + ], "html_body": [ 0 ], diff --git a/tests/rfc/001.txt b/tests/rfc/001.txt index f4f116f..ad24a99 100644 --- a/tests/rfc/001.txt +++ b/tests/rfc/001.txt @@ -41,99 +41,97 @@ get RFC-MIME.DOC ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "id1@host.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "42" - } - } - }, - "content_id": { - "Text": "id001@guppylake.bellcore.com" - }, - "subject": { - "Text": "whatever" - }, - "to": { - "Address": { - "name": "Someone" - } - }, - "from": { - "Address": { - "name": "Whomever" - } + "headers_rfc": { + "from": { + "Address": { + "name": "Whomever" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 15 - }, - { - "name": { - "Rfc": "to" - }, - "start": 18, - "end": 27 - }, - { - "name": { - "Rfc": "date" - }, - "start": 32, - "end": 42 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 50, - "end": 60 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 73, - "end": 78 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 89, - "end": 105 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 118, - "end": 154 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 165, - "end": 197 + "to": { + "Address": { + "name": "Someone" } - ] + }, + "message_id": { + "Text": "id1@host.com" + }, + "content_id": { + "Text": "id001@guppylake.bellcore.com" + }, + "subject": { + "Text": "whatever" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "42" + } + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 15 + }, + { + "name": { + "Rfc": "to" + }, + "start": 18, + "end": 27 + }, + { + "name": { + "Rfc": "date" + }, + "start": 32, + "end": 42 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 50, + "end": 60 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 73, + "end": 78 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 89, + "end": 105 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 118, + "end": 154 + }, + { + "name": { + "Rfc": "content_id" + }, + "start": 165, + "end": 197 + } + ], "attachments": [ { "Attachment": 0 @@ -149,31 +147,20 @@ get RFC-MIME.DOC { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "name": "BodyFormats.ps", - "site": "thumper.bellcore.com", - "mode": "image", - "directory": "pub", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "access-type": "ANON-FTP" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "access-type": "ANON-FTP", + "name": "BodyFormats.ps", + "directory": "pub", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "site": "thumper.bellcore.com", + "mode": "image" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 216, - "end": 432 - } - ] + } }, "contents": [ 67, @@ -261,29 +248,18 @@ get RFC-MIME.DOC { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "site": "thumper.bellcore.com", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "access-type": "local-file", - "name": "/u/nsb/writing/rfcs/RFC-MIME.ps" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "name": "/u/nsb/writing/rfcs/RFC-MIME.ps", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "site": "thumper.bellcore.com", + "access-type": "local-file" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 531, - "end": 735 - } - ] + } }, "contents": [ 67, @@ -371,28 +347,17 @@ get RFC-MIME.DOC { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "external-body", - "attributes": { - "server": "listserv@bogus.bitnet", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "access-type": "mail-server" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "external-body", + "attributes": { + "server": "listserv@bogus.bitnet", + "access-type": "mail-server", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 834, - "end": 1001 - } - ] + } }, "contents": [ 67, diff --git a/tests/rfc/002.txt b/tests/rfc/002.txt index ebdf867..70d80cb 100644 --- a/tests/rfc/002.txt +++ b/tests/rfc/002.txt @@ -73,64 +73,62 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "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" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" - } - } + "headers_rfc": { + "to": { + "Address": { + "name": "White House Transportation Coordinator", + "address": "transport@whitehouse.gov" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 47 - }, - { - "name": { - "Rfc": "to" - }, - "start": 50, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 173 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 186, - "end": 269 + "subject": { + "Text": "[Fwd: Map of Argentina with Description]" + }, + "from": { + "Address": { + "name": "Al Gore", + "address": "vice-president@whitehouse.gov" } - ] + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" + } + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 47 + }, + { + "name": { + "Rfc": "to" + }, + "start": 50, + "end": 123 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 131, + "end": 173 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 186, + "end": 269 + } + ], "html_body": [ 0 ], @@ -146,36 +144,18 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 370, - "end": 400 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 426, - "end": 432 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl", "is_html": false @@ -183,181 +163,154 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz }, { "Multipart": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } - }, - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 550, - "end": 566 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 592, - "end": 598 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 618, - "end": 626 + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - ] + } } }, { "Message": { - "headers": { - "values": { - "to": { - "Address": { - "name": "A1 Gore (The Enforcer)", - "address": "vice-president@whitehouse.gov" - } - }, - "from": { - "Address": { - "name": "Bill Clinton", - "address": "president@whitehouse.gov" - } - }, - "return_path": { - "Text": "president@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" - } - ] - }, - "date": { - "DateTime": { - "year": 1998, - "month": 8, - "day": 13, - "hour": 17, - "minute": 42, - "second": 41, - "tz_before_gmt": false, - "tz_hour": 10, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "DC8------------DC8638F443D87A7F0726DEF7" - } - } - }, - "message_id": { - "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" - }, - "subject": { - "Text": "Map of Argentina with Description" + "headers_rfc": { + "from": { + "Address": { + "name": "Bill Clinton", + "address": "president@whitehouse.gov" } }, - "offsets": [ - { - "name": { - "Rfc": "return_path" - }, - "start": 639, - "end": 667 - }, - { - "name": { - "Rfc": "received" - }, - "start": 676, - "end": 893 - }, - { - "name": { - "Rfc": "received" - }, - "start": 902, - "end": 1100 - }, - { - "name": { - "Rfc": "date" - }, - "start": 1105, - "end": 1138 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 1149, - "end": 1198 - }, - { - "name": { - "Rfc": "from" - }, - "start": 1203, - "end": 1244 - }, - { - "name": { - "Rfc": "to" - }, - "start": 1247, - "end": 1303 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 1311, - "end": 1347 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 1360, - "end": 1365 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 1378, - "end": 1461 + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Map of Argentina with Description" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "DC8------------DC8638F443D87A7F0726DEF7" + } } - ] + }, + "date": { + "DateTime": { + "year": 1998, + "month": 8, + "day": 13, + "hour": 17, + "minute": 42, + "second": 41, + "tz_before_gmt": false, + "tz_hour": 10, + "tz_minute": 0 + } + }, + "return_path": { + "Text": "president@whitehouse.gov" + }, + "to": { + "Address": { + "name": "A1 Gore (The Enforcer)", + "address": "vice-president@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" + } + ] + }, + "message_id": { + "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "return_path" + }, + "start": 639, + "end": 667 + }, + { + "name": { + "Rfc": "received" + }, + "start": 676, + "end": 893 + }, + { + "name": { + "Rfc": "received" + }, + "start": 902, + "end": 1100 + }, + { + "name": { + "Rfc": "date" + }, + "start": 1105, + "end": 1138 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 1149, + "end": 1198 + }, + { + "name": { + "Rfc": "from" + }, + "start": 1203, + "end": 1244 + }, + { + "name": { + "Rfc": "to" + }, + "start": 1247, + "end": 1303 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 1311, + "end": 1347 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 1360, + "end": 1365 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 1378, + "end": 1461 + } + ], "html_body": [ 0, 1 @@ -375,36 +328,18 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 1562, - "end": 1592 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1618, - "end": 1624 - } - ] + } }, "contents": "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", "is_html": false @@ -413,51 +348,26 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Binary": { "headers": { - "values": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "fi1ename": "map_of_Argentina.gif" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "gif", - "attributes": { - "name": "map_of_Argentina.gif" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "gif", + "attributes": { + "name": "map_of_Argentina.gif" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 2036, - "end": 2076 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 2102, - "end": 2110 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 2130, - "end": 2171 + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "fi1ename": "map_of_Argentina.gif" + } } - ] + } }, "contents": [ 71, diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index 932d113..c43e6d8 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -25,94 +25,92 @@ Content-Type: application/x-whatever ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "subject": { - "Text": "Formatted text mail" - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 22, - "hour": 9, - "minute": 41, - "second": 9, - "tz_before_gmt": true, - "tz_hour": 8, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary42" - } - } + "headers_rfc": { + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 46 - }, - { - "name": { - "Rfc": "to" - }, - "start": 49, - "end": 79 - }, - { - "name": { - "Rfc": "date" - }, - "start": 84, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 152 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 165, - "end": 170 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 183, - "end": 227 + "subject": { + "Text": "Formatted text mail" + }, + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 22, + "hour": 9, + "minute": 41, + "second": 9, + "tz_before_gmt": true, + "tz_hour": 8, + "tz_minute": 0 } - ] + }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary42" + } + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 46 + }, + { + "name": { + "Rfc": "to" + }, + "start": 49, + "end": 79 + }, + { + "name": { + "Rfc": "date" + }, + "start": 84, + "end": 123 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 131, + "end": 152 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 165, + "end": 170 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 183, + "end": 227 + } + ], "html_body": [ 0 ], @@ -131,26 +129,15 @@ Content-Type: application/x-whatever { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 254, - "end": 284 - } - ] + } }, "contents": "... plain text version of message goes here ...\n", "is_html": false @@ -159,23 +146,12 @@ Content-Type: application/x-whatever { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "enriched" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "enriched" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 360, - "end": 375 - } - ] + } }, "contents": "... RFC 1896 text/enriched version of same message\n goes here ...\n", "is_html": false @@ -184,23 +160,12 @@ Content-Type: application/x-whatever { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "x-whatever" - } + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "x-whatever" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 472, - "end": 496 - } - ] + } }, "contents": [ 46, diff --git a/tests/rfc/004.txt b/tests/rfc/004.txt index c48fb5e..76fc4d1 100644 --- a/tests/rfc/004.txt +++ b/tests/rfc/004.txt @@ -36,92 +36,90 @@ Subject: my different opinion ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "---- main boundary ----" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "---- main boundary ----" } - }, - "subject": { - "Text": "Internet Digest, volume 42" - }, - "from": { - "Address": { - "name": "Moderator-Address" - } - }, - "to": { - "Address": { - "name": "Recipient-List" - } - }, - "date": { - "DateTime": { - "year": 1994, - "month": 3, - "day": 22, - "hour": 13, - "minute": 34, - "second": 51, - "tz_before_gmt": false, - "tz_hour": 0, - "tz_minute": 0 - } - }, - "mime_version": { - "Text": "1.0" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 24 - }, - { - "name": { - "Rfc": "to" - }, - "start": 27, - "end": 43 - }, - { - "name": { - "Rfc": "date" - }, - "start": 48, - "end": 81 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 89, - "end": 117 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 130, - "end": 135 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 148, - "end": 213 + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Moderator-Address" } - ] + }, + "to": { + "Address": { + "name": "Recipient-List" + } + }, + "date": { + "DateTime": { + "year": 1994, + "month": 3, + "day": 22, + "hour": 13, + "minute": 34, + "second": 51, + "tz_before_gmt": false, + "tz_hour": 0, + "tz_minute": 0 + } + }, + "subject": { + "Text": "Internet Digest, volume 42" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 24 + }, + { + "name": { + "Rfc": "to" + }, + "start": 27, + "end": 43 + }, + { + "name": { + "Rfc": "date" + }, + "start": 48, + "end": 81 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 89, + "end": 117 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 130, + "end": 135 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 148, + "end": 213 + } + ], "html_body": [ 0 ], @@ -145,90 +143,75 @@ Subject: my different opinion }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "digest", - "attributes": { - "boundary": "---- next message ----" - } - } - } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 326, - "end": 391 - } - ] - } - }, - { - "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "digest", + "attributes": { + "boundary": "---- next message ----" } } } } }, + { + "Multipart": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" + } + } + } + }, { "Message": { - "headers": { - "values": { - "from": { - "Address": { - "name": "someone-else" - } - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 11, - "minute": 13, - "second": 32, - "tz_before_gmt": false, - "tz_hour": 2, - "tz_minute": 0 - } - }, - "subject": { - "Text": "my opinion" + "headers_rfc": { + "subject": { + "Text": "my opinion" + }, + "from": { + "Address": { + "name": "someone-else" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 423, - "end": 437 - }, - { - "name": { - "Rfc": "date" - }, - "start": 442, - "end": 475 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 483, - "end": 495 + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 11, + "minute": 13, + "second": 32, + "tz_before_gmt": false, + "tz_hour": 2, + "tz_minute": 0 } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 423, + "end": 437 + }, + { + "name": { + "Rfc": "date" + }, + "start": 442, + "end": 475 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 483, + "end": 495 + } + ], "html_body": [ 0 ], @@ -253,66 +236,62 @@ Subject: my different opinion }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "subject": { - "Text": "my different opinion" - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 10, - "minute": 7, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 5, - "tz_minute": 0 - } - }, - "from": { - "Address": { - "name": "someone-else-again" - } + "headers_rfc": { + "subject": { + "Text": "my different opinion" + }, + "from": { + "Address": { + "name": "someone-else-again" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 550, - "end": 570 - }, - { - "name": { - "Rfc": "date" - }, - "start": 575, - "end": 608 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 616, - "end": 638 + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 10, + "minute": 7, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 550, + "end": 570 + }, + { + "name": { + "Rfc": "date" + }, + "start": 575, + "end": 608 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 616, + "end": 638 + } + ], "html_body": [ 0 ], diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index 0518438..d6d96bc 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -25,94 +25,92 @@ This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "subject": { - "Text": "Sample message" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "simple boundary" - } - } - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 21, - "hour": 23, - "minute": 56, - "second": 48, - "tz_before_gmt": true, - "tz_hour": 8, - "tz_minute": 0 - } + "headers_rfc": { + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 21, + "hour": 23, + "minute": 56, + "second": 48, + "tz_before_gmt": true, + "tz_hour": 8, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 46 - }, - { - "name": { - "Rfc": "to" - }, - "start": 49, - "end": 79 - }, - { - "name": { - "Rfc": "date" - }, - "start": 84, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 147 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 160, - "end": 165 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 178, - "end": 223 + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Sample message" + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" } - ] + }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "simple boundary" + } + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 46 + }, + { + "name": { + "Rfc": "to" + }, + "start": 49, + "end": 79 + }, + { + "name": { + "Rfc": "date" + }, + "start": 84, + "end": 123 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 131, + "end": 147 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 160, + "end": 165 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 178, + "end": 223 + } + ], "html_body": [ 0, 1 @@ -131,26 +129,15 @@ This is the epilogue. It is also to be ignored. { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 512, - "end": 542 - } - ] + } }, "contents": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n", "is_html": false diff --git a/tests/rfc/006.txt b/tests/rfc/006.txt index b413321..a5f0c76 100644 --- a/tests/rfc/006.txt +++ b/tests/rfc/006.txt @@ -23,62 +23,60 @@ Content-Disposition: inline ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "Multipart Email Example" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary-string" - } - } - }, - "from": { - "Address": { - "address": "sender@example.com" - } - }, - "to": { - "Address": { - "address": "recipient@example.com" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary-string" } } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 25 - }, - { - "name": { - "Rfc": "to" - }, - "start": 28, - "end": 51 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 59, - "end": 84 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 97, - "end": 148 + "subject": { + "Text": "Multipart Email Example" + }, + "to": { + "Address": { + "address": "recipient@example.com" } - ] + }, + "from": { + "Address": { + "address": "sender@example.com" + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 25 + }, + { + "name": { + "Rfc": "to" + }, + "start": 28, + "end": 51 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 59, + "end": 84 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 97, + "end": 148 + } + ], "html_body": [ 1 ], @@ -89,48 +87,23 @@ Content-Disposition: inline { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } - } + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 180, - "end": 209 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 235, - "end": 253 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 273, - "end": 281 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" + } } - ] + } }, "contents": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n", "is_html": false @@ -139,48 +112,23 @@ Content-Disposition: inline { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "utf-8" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" + "content_disposition": { + "ContentType": { + "c_type": "inline" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "utf-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 401, - "end": 429 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 455, - "end": 473 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 493, - "end": 501 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n", "is_html": true diff --git a/tests/rfc/007.txt b/tests/rfc/007.txt index 26ada3d..4910a65 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -73,38 +73,36 @@ K ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "RFC 8621 Section 4.1.4 test" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } }, - "offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 37 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 50, - "end": 81 - } - ] + "subject": { + "Text": "RFC 8621 Section 4.1.4 test" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 8, + "end": 37 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 50, + "end": 81 + } + ], "html_body": [ 0, 8, @@ -138,35 +136,17 @@ K { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 99, - "end": 111 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 131, - "end": 139 + "content_disposition": { + "ContentType": { + "c_type": "inline" } - ] + } }, "contents": "A", "is_html": false @@ -174,108 +154,57 @@ K }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 161, - "end": 192 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "3" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "3" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 210, - "end": 247 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "4" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "4" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 265, - "end": 296 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 314, - "end": 326 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 346, - "end": 354 + "content_disposition": { + "ContentType": { + "c_type": "inline" } - ] + } }, "contents": "B", "is_html": false @@ -284,35 +213,17 @@ K { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 376, - "end": 388 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 408, - "end": 416 + "content_disposition": { + "ContentType": { + "c_type": "inline" } - ] + } }, "contents": [ 67 @@ -322,35 +233,17 @@ K { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 438, - "end": 450 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 470, - "end": 478 + "content_disposition": { + "ContentType": { + "c_type": "inline" } - ] + } }, "contents": "D", "is_html": false @@ -358,48 +251,26 @@ K }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "boundary": "5" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "boundary": "5" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 506, - "end": 539 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 557, - "end": 568 - } - ] + } }, "contents": "E", "is_html": true @@ -408,23 +279,12 @@ K { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg" - } + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 603, - "end": 615 - } - ] + } }, "contents": [ 70 @@ -434,35 +294,17 @@ K { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "jpeg" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment" - } + "content_disposition": { + "ContentType": { + "c_type": "attachment" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 655, - "end": 667 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 687, - "end": 699 + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "jpeg" } - ] + } }, "contents": [ 71 @@ -472,23 +314,12 @@ K { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "x-excel" - } + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "x-excel" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 721, - "end": 742 - } - ] + } }, "contents": [ 72 @@ -497,43 +328,30 @@ K }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 764, - "end": 780 - } - ] + } } }, { "Message": { - "headers": { - "values": { - "subject": { - "Text": "J" - } - }, - "offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 789, - "end": 792 - } - ] + "headers_rfc": { + "subject": { + "Text": "J" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 789, + "end": 792 + } + ], "html_body": [ 0 ], @@ -559,35 +377,17 @@ K { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } + "content_disposition": { + "ContentType": { + "c_type": "inline" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 821, - "end": 833 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 853, - "end": 861 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "K", "is_html": false diff --git a/tests/thirdparty/000.txt b/tests/thirdparty/000.txt index 0ff781c..b61146a 100644 --- a/tests/thirdparty/000.txt +++ b/tests/thirdparty/000.txt @@ -20,38 +20,36 @@ ZWg= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "bound" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "bound" } } }, - "offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 19 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 32, - "end": 76 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "mime_version" + }, + "start": 13, + "end": 19 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 32, + "end": 76 + } + ], "html_body": [ 0, 1 @@ -64,33 +62,15 @@ ZWg= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 128, - "end": 137 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 150, - "end": 163 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a", "is_html": false @@ -99,33 +79,15 @@ ZWg= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "base64" - } + "content_transfer_encoding": { + "Text": "base64" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 413, - "end": 426 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 452, - "end": 461 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "eh", "is_html": false diff --git a/tests/thirdparty/001.txt b/tests/thirdparty/001.txt index c000a25..134b4e0 100644 --- a/tests/thirdparty/001.txt +++ b/tests/thirdparty/001.txt @@ -25,38 +25,36 @@ hello world ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "bound" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "bound" } } }, - "offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 19 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 32, - "end": 76 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "mime_version" + }, + "start": 13, + "end": 19 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 32, + "end": 76 + } + ], "html_body": [ 0, 1, @@ -71,33 +69,15 @@ hello world { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 128, - "end": 137 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 150, - "end": 163 - } - ] + "content_transfer_encoding": { + "Text": "binary" + } }, "contents": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=\r", "is_html": false @@ -106,33 +86,15 @@ hello world { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" - } + "content_transfer_encoding": { + "Text": "binary" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 413, - "end": 426 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 452, - "end": 461 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "ZWg=", "is_html": false @@ -141,23 +103,12 @@ hello world { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 490, - "end": 503 - } - ] + } }, "contents": "hello world\r\n\r", "is_html": false diff --git a/tests/thirdparty/002.txt b/tests/thirdparty/002.txt index 2821f6d..30d4ebf 100644 --- a/tests/thirdparty/002.txt +++ b/tests/thirdparty/002.txt @@ -20,28 +20,26 @@ Content-Type: text/plain; charset=utf-8 ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "foo" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "foo" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + } + ], "html_body": [ 0, 1 @@ -59,36 +57,18 @@ Content-Type: text/plain; charset=utf-8 { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 77, - "end": 95 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 108, - "end": 135 - } - ] + "content_transfer_encoding": { + "Text": "quoted-printable" + } }, "contents": "päivää\n", "is_html": false @@ -97,36 +77,18 @@ Content-Type: text/plain; charset=utf-8 { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 191, - "end": 199 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 212, - "end": 239 - } - ] + } }, "contents": "yötä vaan.\n�\t�", "is_html": false @@ -135,36 +97,18 @@ Content-Type: text/plain; charset=utf-8 { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 301, - "end": 309 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 322, - "end": 349 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": "?garbage", "is_html": false diff --git a/tests/thirdparty/003.txt b/tests/thirdparty/003.txt index a3a6f64..7be3665 100644 --- a/tests/thirdparty/003.txt +++ b/tests/thirdparty/003.txt @@ -35,38 +35,36 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "mime_version": { - "Text": "1.0" - } + "headers_rfc": { + "mime_version": { + "Text": "1.0" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" + } } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 57, + "end": 62 + } + ], "html_body": [ 0, 1, @@ -85,36 +83,18 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 93, - "end": 104 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 117, - "end": 147 - } - ] + "content_transfer_encoding": { + "Text": "7bit" + } }, "contents": "Move black king to queen's bishop\n", "is_html": false @@ -123,36 +103,18 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "binary" - }, - "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" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 213, - "end": 224 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 237, - "end": 264 - } - ] + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -161,36 +123,18 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - }, - "content_transfer_encoding": { - "Text": "8bit" } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 318, - "end": 328 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 341, - "end": 368 - } - ] + "content_transfer_encoding": { + "Text": "8bit" + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -199,36 +143,18 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 422, - "end": 455 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 468, - "end": 495 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } } - ] + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -237,36 +163,18 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 567, - "end": 575 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 588, - "end": 615 - } - ] + "content_transfer_encoding": { + "Text": "base64" + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false diff --git a/tests/thirdparty/004.txt b/tests/thirdparty/004.txt index c5a612e..55e3130 100644 --- a/tests/thirdparty/004.txt +++ b/tests/thirdparty/004.txt @@ -41,38 +41,36 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 13, + "end": 44 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 57, + "end": 62 + } + ], "html_body": [ 0, 1, @@ -93,36 +91,18 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "6bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 93, - "end": 99 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 112, - "end": 139 - } - ] + "content_transfer_encoding": { + "Text": "6bit" + } }, "contents": "Move black king to queen's bishop\n", "is_html": false @@ -131,36 +111,18 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } - }, - "content_transfer_encoding": { - "Text": "7bits" } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 205, - "end": 218 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 231, - "end": 258 - } - ] + "content_transfer_encoding": { + "Text": "7bits" + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -169,36 +131,18 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "8 bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 312, - "end": 319 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 332, - "end": 359 - } - ] + "content_transfer_encoding": { + "Text": "8 bit" + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -207,36 +151,18 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, - "content_transfer_encoding": { - "Text": "7-bit" - } + "content_transfer_encoding": { + "Text": "7-bit" }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 413, - "end": 420 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 433, - "end": 460 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } } - ] + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -245,36 +171,18 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "8-bit" - }, - "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" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 514, - "end": 521 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 534, - "end": 561 - } - ] + } }, "contents": "Move ♚ to ♛'s ♝\n", "is_html": false @@ -283,33 +191,15 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 615, - "end": 616 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 629, - "end": 656 - } - ] + } }, "contents": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n", "is_html": false diff --git a/tests/thirdparty/005.txt b/tests/thirdparty/005.txt index 76d5b54ecc2c2ec0ddab29ccd1a9ddbcb6144adc..fae7c0aed5f89349480e7fd7d746f78c613bfcb5 100644 GIT binary patch delta 571 zcmbQK|3`L14-;p6QChN+l|nVwhrPRC>puC9*#0Zdf1(2ga>ik(`^uY###FUCl z5{p1iG&P4P0t!L&ni)a#0?F9PD_9;*uHliLJex;;@*WB*u2VRU7#Yqt%mMaB$)DS3fB(V@lgB&_>3j_XuqFuE= z&`rAOy2$S&ZSont^CCH-B+F=#O05?bXXd`=oIB*Sqlm@Op5lMdZ)ec9zC1CE*#8EfKY1En>^W|nK1i}|d*<{GH}JISHV*m^ ztv$mCq6=>x_y7*eV&$_ev-A9<)9!a3m|yiz2krjgv}3Y)<2%DN(TsRLzzQ9hYzPye zo{?eo{Zj>fT{MlvDnD2LHKx zG^62sIEwwtya;unY>OX9{4_w}j6EXOYHpw}9vj;t;fi(5 zB|36jl?{k#5$tULV7dZ%IiGKz?5;y1yDP*{Se3#GM56C19Ertz2Nw-jiNhq&YF;S= zIlEYyHR9wFC3^9Wzf5Wk$&?*&N7gd|#I zT4k#^R#adT&BYLktthx(qM$S`h-lYs&4`wRSw+I;!LsewOs|X2wq3!oB6=hP%v*(6 zDi{1Lw_gfdH6}(H=zb|RLz1T6lzbhPP=bPV$Y>8j6K|dpX-Qa@*3?d^9;(Kli){S- z*K1hHla)i|su)v5D2lb!WE)lRu}H4Pae42xN^BR|oVq+P#3t~K5@2@hdJb7OttIjK z*ycE^+JVz#hg|VjuK4b;?f-EC>5a2!36;}g-NC-B*OZW;0d>3B)^Jv_tY?XL=Oe<8q9xHproeBF18k2mmf#^QmG-y|E; zEGcfV(32o#H&U-;9L4t%IuUnOs*B~csEVjQvPLAoXi{~lT2Uwe8Y}r78IP9Liwn!w cuc5f`fo%9?m70~;SfUTANdcD@e0^N~1xE{3(*OVf diff --git a/tests/thirdparty/006.txt b/tests/thirdparty/006.txt index 7a06fc2..03afd08 100644 --- a/tests/thirdparty/006.txt +++ b/tests/thirdparty/006.txt @@ -30,48 +30,46 @@ Signed by undersigned --1-- ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } + "headers_rfc": { + "subject": { + "Text": "Hide and seek" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" } - }, - "subject": { - "Text": "Hide and seek" } }, - "offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 23 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 36, - "end": 41 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 54, - "end": 83 - } - ] + "mime_version": { + "Text": "1.0" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 8, + "end": 23 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 36, + "end": 41 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 54, + "end": 83 + } + ], "html_body": [ 2 ], @@ -86,89 +84,44 @@ Signed by undersigned "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "signed", - "attributes": { - "boundary": "2", - "protocol": "signature/plain", - "migalc": "pen+paper" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "signed", + "attributes": { + "protocol": "signature/plain", + "migalc": "pen+paper", + "boundary": "2" } } - }, - "other_values": { - "X-Signature-Type": { - "Text": "penmanship" - } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 101, - "end": 179 - }, - { - "name": { - "Other": "X-Signature-Type" - }, - "start": 196, - "end": 208 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "3" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "3" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 226, - "end": 261 - } - ] + } } }, { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 279, - "end": 308 - } - ] + } }, "contents": "Search me

Don't find me here

\n", "is_html": true @@ -177,33 +130,15 @@ Signed by undersigned { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" - } + "content_transfer_encoding": { + "Text": "binary" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 416, - "end": 428 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 454, - "end": 462 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "Search me, and Find me here", "is_html": false @@ -212,26 +147,15 @@ Signed by undersigned { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "signature", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "signature", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 515, - "end": 550 - } - ] + } }, "contents": [ 83, diff --git a/tests/thirdparty/007.txt b/tests/thirdparty/007.txt index 1f718c2..b610d9f 100644 --- a/tests/thirdparty/007.txt +++ b/tests/thirdparty/007.txt @@ -34,41 +34,39 @@ Foobar --1-- ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "digest", - "attributes": { - "boundary": "1" - } - } - }, - "from": { - "Address": { - "name": "Moderator-Address", - "address": "moderator" + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "digest", + "attributes": { + "boundary": "1" } } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 36 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 49, - "end": 80 + "from": { + "Address": { + "name": "Moderator-Address", + "address": "moderator" } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 5, + "end": 36 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 49, + "end": 80 + } + ], "attachments": [ { "Attachment": 1 @@ -83,47 +81,43 @@ Foobar "parts": [ { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "from": { - "Address": { - "name": "someone-else", - "address": "someone@else" - } - }, - "subject": { - "Text": "my opinion" + "headers_rfc": { + "from": { + "Address": { + "name": "someone-else", + "address": "someone@else" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 92, - "end": 121 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 129, - "end": 141 - } - ] + "subject": { + "Text": "my opinion" + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 92, + "end": 121 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 129, + "end": 141 + } + ], "html_body": [ 0 ], @@ -148,47 +142,43 @@ Foobar }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "subject": { - "Text": "i disagree" - }, - "from": { - "Address": { - "name": "another one", - "address": "another@one" - } - } + "headers_rfc": { + "subject": { + "Text": "i disagree" }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 171, - "end": 198 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 206, - "end": 218 + "from": { + "Address": { + "name": "another one", + "address": "another@one" } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 171, + "end": 198 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 206, + "end": 218 + } + ], "html_body": [ 0 ], @@ -213,63 +203,59 @@ Foobar }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } } }, { "Message": { - "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } + "headers_rfc": { + "subject": { + "Text": "funny hat" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" } - }, - "from": { - "Address": { - "name": "attachment", - "address": "attachment@user" - } - }, - "subject": { - "Text": "funny hat" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 251, - "end": 281 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 289, - "end": 300 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 313, - "end": 342 + "from": { + "Address": { + "name": "attachment", + "address": "attachment@user" } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 251, + "end": 281 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 289, + "end": 300 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 313, + "end": 342 + } + ], "html_body": [ 0 ], @@ -285,33 +271,15 @@ Foobar { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 360, - "end": 372 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 398, - "end": 406 - } - ] + "content_transfer_encoding": { + "Text": "binary" + } }, "contents": "Lovely attachment for you", "is_html": false @@ -320,37 +288,19 @@ Foobar { "Binary": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "binary" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "test.txt", - "disposition": "attachment" - } + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "name": "test.txt", + "disposition": "attachment" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 450, - "end": 517 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 543, - "end": 551 - } - ] + } }, "contents": [ 70, diff --git a/tests/thirdparty/008.txt b/tests/thirdparty/008.txt index 2e7bb2b..f6d3391 100644 --- a/tests/thirdparty/008.txt +++ b/tests/thirdparty/008.txt @@ -57,82 +57,80 @@ Root MIME epilogue ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2007, - "month": 3, - "day": 24, - "hour": 23, - "minute": 0, - "second": 0, - "tz_before_gmt": false, - "tz_hour": 2, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "foo bar" - } - } - }, - "from": { - "Address": { - "address": "user@domain.org" - } + "headers_rfc": { + "from": { + "Address": { + "address": "user@domain.org" } }, - "other_values": { - "From user@domain Fri Feb 22 17": { - "Text": "06:23 2008" + "date": { + "DateTime": { + "year": 2007, + "month": 3, + "day": 24, + "hour": 23, + "minute": 0, + "second": 0, + "tz_before_gmt": false, + "tz_hour": 2, + "tz_minute": 0 } }, - "offsets": [ - { - "name": { - "Other": "From user@domain Fri Feb 22 17" - }, - "start": 32, - "end": 43 - }, - { - "name": { - "Rfc": "from" - }, - "start": 48, - "end": 65 - }, - { - "name": { - "Rfc": "date" - }, - "start": 70, - "end": 103 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 116, - "end": 121 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 134, - "end": 171 + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "foo bar" + } } - ] + } }, + "headers_other": { + "From user@domain Fri Feb 22 17": { + "Text": "06:23 2008" + } + }, + "headers_offsets": [ + { + "name": { + "Other": "From user@domain Fri Feb 22 17" + }, + "start": 32, + "end": 43 + }, + { + "name": { + "Rfc": "from" + }, + "start": 48, + "end": 65 + }, + { + "name": { + "Rfc": "date" + }, + "start": 70, + "end": 103 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 116, + "end": 121 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 134, + "end": 171 + } + ], "html_body": [ 3 ], @@ -151,26 +149,15 @@ Root MIME epilogue { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "x-myown", - "attributes": { - "charset": "us-ascii" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "x-myown", + "attributes": { + "charset": "us-ascii" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 215, - "end": 247 - } - ] + } }, "contents": "hello\n", "is_html": false @@ -178,91 +165,78 @@ Root MIME epilogue }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 278, - "end": 294 - } - ] + } } }, { "Message": { - "headers": { - "values": { - "subject": { - "Text": "submsg" - }, - "from": { - "Address": { - "address": "sub@domain.org" - } - }, - "date": { - "DateTime": { - "year": 2012, - "month": 8, - "day": 12, - "hour": 12, - "minute": 34, - "second": 56, - "tz_before_gmt": false, - "tz_hour": 3, - "tz_minute": 0 - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub1" - } - } + "headers_rfc": { + "subject": { + "Text": "submsg" + }, + "from": { + "Address": { + "address": "sub@domain.org" } }, - "offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 316 - }, - { - "name": { - "Rfc": "date" - }, - "start": 321, - "end": 354 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 362, - "end": 370 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 383, - "end": 423 + "date": { + "DateTime": { + "year": 2012, + "month": 8, + "day": 12, + "hour": 12, + "minute": 34, + "second": 56, + "tz_before_gmt": false, + "tz_hour": 3, + "tz_minute": 0 } - ] + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub1" + } + } + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 300, + "end": 316 + }, + { + "name": { + "Rfc": "date" + }, + "start": 321, + "end": 354 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 362, + "end": 370 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 383, + "end": 423 + } + ], "html_body": [ 0, 4 @@ -276,23 +250,12 @@ Root MIME epilogue { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 462, - "end": 473 - } - ] + } }, "contents": "

Hello world

\n", "is_html": true @@ -300,50 +263,28 @@ Root MIME epilogue }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub2" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub2" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 514, - "end": 554 - } - ] + } } }, { "Multipart": { - "values": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub3" - } + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub3" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 575, - "end": 615 - } - ] + } } }, { @@ -403,23 +344,12 @@ Root MIME epilogue { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 752, - "end": 764 - } - ] + } }, "contents": "Another part", "is_html": false diff --git a/tests/thirdparty/009.txt b/tests/thirdparty/009.txt index d8d0666..1e489ad 100644 --- a/tests/thirdparty/009.txt +++ b/tests/thirdparty/009.txt @@ -21,48 +21,46 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "subject": { - "Text": "In parts" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "1" - } - } - }, - "mime_version": { - "Text": "1.0" - } + "headers_rfc": { + "subject": { + "Text": "In parts" }, - "offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 18 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 31, - "end": 36 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 49, - "end": 78 + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "1" + } } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 8, + "end": 18 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 31, + "end": 36 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 49, + "end": 78 + } + ], "html_body": [ 0 ], @@ -78,33 +76,15 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= { "Text": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" - } + "content_transfer_encoding": { + "Text": "binary" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 96, - "end": 108 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 134, - "end": 142 + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "Hi, this is the fancy thing I was talking about!", "is_html": false @@ -113,28 +93,17 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= { "Binary": { "headers": { - "values": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "partial", - "attributes": { - "number": "1", - "total": "5", - "id": "heks68ewe@example.org" - } + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "partial", + "attributes": { + "number": "1", + "total": "5", + "id": "heks68ewe@example.org" } } - }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 209, - "end": 273 - } - ] + } }, "contents": [ 88, diff --git a/tests/thirdparty/010.txt b/tests/thirdparty/010.txt index b090517..8cfc56d 100644 --- a/tests/thirdparty/010.txt +++ b/tests/thirdparty/010.txt @@ -12,49 +12,47 @@ Content-Language: ja --1-- ---- EXPECTED STRUCTURE ---- { - "headers": { - "values": { - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "こんにちは" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "comment": "人権の無視及", - "boundary": "1" - } + "headers_rfc": { + "subject": { + "Text": "こんにちは" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "comment": "人権の無視及", + "boundary": "1" } } - }, - "offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 42 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 55, - "end": 60 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 73, - "end": 145 - } - ] + } }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 8, + "end": 42 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 55, + "end": 60 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 73, + "end": 145 + } + ], "html_body": [ 0 ], @@ -65,43 +63,18 @@ Content-Language: ja { "Text": { "headers": { - "values": { - "content_transfer_encoding": { - "Text": "binary" - }, - "content_language": { - "Text": "ja" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - } + "content_transfer_encoding": { + "Text": "binary" }, - "offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 163, - "end": 175 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 201, - "end": 209 - }, - { - "name": { - "Rfc": "content_language" - }, - "start": 226, - "end": 230 + "content_language": { + "Text": "ja" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } - ] + } }, "contents": "人権の無視及", "is_html": false