diff --git a/src/lib.rs b/src/lib.rs index e039cc3..97a58af 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -272,7 +272,6 @@ pub struct Message<'x> { #[cfg_attr(feature = "serde_support", serde(default))] pub headers_rfc: RfcHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] - #[cfg_attr(feature = "serde_support", serde(skip))] pub headers_raw: RawHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] @@ -318,41 +317,20 @@ pub struct Part<'x, T> { #[cfg_attr(feature = "serde_support", serde(default))] pub headers_rfc: RfcHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] - #[cfg_attr(feature = "serde_support", serde(skip))] pub headers_raw: RawHeaders<'x>, pub is_encoding_problem: bool, pub body: T, + pub offset_header: usize, + pub offset_body: usize, + pub offset_end: usize, } impl<'x, T> Part<'x, T> { - pub fn new( - headers_rfc: RfcHeaders<'x>, - headers_raw: RawHeaders<'x>, - body: T, - is_encoding_problem: bool, - ) -> Self { - Self { - headers_rfc, - headers_raw, - body, - is_encoding_problem, - } - } - pub fn get_body(&self) -> &T { &self.body } } -impl<'x> MultiPart<'x> { - pub fn new(headers_rfc: RfcHeaders<'x>, headers_raw: RawHeaders<'x>) -> Self { - Self { - headers_rfc, - headers_raw, - } - } -} - /// Multipart part #[derive(Debug, Default, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] @@ -360,8 +338,10 @@ pub struct MultiPart<'x> { #[cfg_attr(feature = "serde_support", serde(default))] pub headers_rfc: RfcHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] - #[cfg_attr(feature = "serde_support", serde(skip))] pub headers_raw: RawHeaders<'x>, + pub offset_header: usize, + pub offset_body: usize, + pub offset_end: usize, } /// Unique ID representing a MIME part within a message. @@ -399,6 +379,19 @@ pub enum MessagePart<'x> { } impl<'x> MessagePart<'x> { + pub fn raw_offsets(&self) -> (usize, usize, usize) { + match self { + MessagePart::Text(part) => (part.offset_header, part.offset_body, part.offset_end), + MessagePart::Html(part) => (part.offset_header, part.offset_body, part.offset_end), + MessagePart::Binary(part) => (part.offset_header, part.offset_body, part.offset_end), + MessagePart::InlineBinary(part) => { + (part.offset_header, part.offset_body, part.offset_end) + } + MessagePart::Message(part) => (part.offset_header, part.offset_body, part.offset_end), + MessagePart::Multipart(part) => (part.offset_header, part.offset_body, part.offset_end), + } + } + pub fn unwrap_text(&self) -> &Part<'x, Cow<'x, str>> { match self { MessagePart::Text(part) => part, @@ -500,13 +493,19 @@ pub type RfcHeaders<'x> = HashMap>; pub type RawHeaders<'x> = Vec<(HeaderName<'x>, HeaderOffset)>; /// Offset of a message element in the raw message. -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone, Default)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct HeaderOffset { pub start: usize, pub end: usize, } +impl HeaderOffset { + pub fn new(start: usize, end: usize) -> Self { + Self { start, end } + } +} + #[derive(Debug, PartialEq, Eq, Hash, Clone)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum HeaderName<'x> { diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 1f06c62..54d8729 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -22,7 +22,10 @@ use crate::{ use super::{ header::parse_headers, - mime::{get_bytes_to_boundary, seek_crlf_end, seek_next_part, skip_crlf, skip_multipart_end}, + mime::{ + get_bytes_to_boundary, seek_crlf, seek_next_part, seek_part_end, skip_crlf, + skip_multipart_end, + }, }; const MIME_HEADERS: &[RfcHeader] = &[ @@ -152,8 +155,11 @@ struct MessageParserState { text_parts: usize, need_html_body: bool, need_text_body: bool, - header_id: Option, + part_id: Option, structure: Vec, + offset_header: usize, + offset_body: usize, + offset_end: usize, } impl MessageParserState { @@ -172,8 +178,8 @@ impl MessageParserState { } pub fn get_structure(&mut self) -> MessageStructure { - if let Some(header_id) = self.header_id { - MessageStructure::MultiPart((header_id, std::mem::take(&mut self.structure))) + if let Some(part_id) = self.part_id { + MessageStructure::MultiPart((part_id, std::mem::take(&mut self.structure))) } else if self.structure.len() > 1 { MessageStructure::List(std::mem::take(&mut self.structure)) } else if self.structure.len() == 1 { @@ -227,8 +233,8 @@ impl<'x> Message<'x> { 'outer: loop { // Parse headers + state.offset_header = stream.pos; let (is_message, header) = if let MimeType::Message = state.mime_type { - message.offset_header = stream.pos; if !parse_headers( &mut message.headers_rfc, &mut message.headers_raw, @@ -236,7 +242,6 @@ impl<'x> Message<'x> { ) { break; } - message.offset_body = seek_crlf_end(&stream, stream.pos); (true, &mut message.headers_rfc) } else { if !parse_headers( @@ -262,7 +267,8 @@ impl<'x> Message<'x> { if let Some(mime_boundary) = content_type.map_or_else(|| None, |f| f.get_attribute("boundary")) { - let mime_boundary = ("\n--".to_string() + mime_boundary).into_bytes(); + let mime_boundary = format!("\n--{}", mime_boundary).into_bytes(); + state.offset_body = seek_crlf(&stream, stream.pos); if seek_next_part(&mut stream, mime_boundary.as_ref()) { let new_state = MessageParserState { @@ -274,7 +280,7 @@ impl<'x> Message<'x> { text_parts: message.text_body.len(), need_html_body: state.need_html_body, need_text_body: state.need_text_body, - header_id: if !is_message { + part_id: if !is_message { Some(message.parts.len()) } else { None @@ -283,10 +289,13 @@ impl<'x> Message<'x> { }; if !is_message { add_missing_type(&mut mime_part_header, "text".into(), "plain".into()); - message.parts.push(MessagePart::Multipart(MultiPart::new( - std::mem::take(&mut mime_part_header), - std::mem::take(&mut mime_part_header_raw), - ))); + message.parts.push(MessagePart::Multipart(MultiPart { + headers_rfc: std::mem::take(&mut mime_part_header), + headers_raw: std::mem::take(&mut mime_part_header_raw), + offset_header: state.offset_header, + offset_body: state.offset_body, + offset_end: 0, + })); } state_stack.push(state); state = new_state; @@ -300,6 +309,7 @@ impl<'x> Message<'x> { } skip_crlf(&mut stream); + state.offset_body = stream.pos; let (is_binary, decode_fnc): (bool, DecodeFnc) = match header .get(&RfcHeader::ContentTransferEncoding) @@ -373,7 +383,7 @@ impl<'x> Message<'x> { }; if bytes_read == 0 { - // If there is MIME boundary, ignore it and get raw message + // If there is a MIME boundary, ignore it and get raw message if state.mime_boundary.is_some() { let (bytes_read, r_bytes) = get_bytes_to_boundary(&stream, stream.pos, &[][..], false); @@ -398,6 +408,7 @@ impl<'x> Message<'x> { } else { stream.pos += bytes_read; } + state.offset_end = seek_part_end(&stream, stream.pos, state.mime_boundary.as_deref()); if mime_type != MimeType::Message { let is_inline = is_inline @@ -441,6 +452,9 @@ impl<'x> Message<'x> { headers_rfc: std::mem::take(&mut mime_part_header), headers_raw: std::mem::take(&mut mime_part_header_raw), is_encoding_problem, + offset_header: state.offset_header, + offset_body: state.offset_body, + offset_end: state.offset_end, }; // If there is a single part in the message, move MIME headers @@ -496,12 +510,15 @@ impl<'x> Message<'x> { message.attachments.push(message.parts.len()); - let mut binary_part = Part::new( - std::mem::take(&mut mime_part_header), - std::mem::take(&mut mime_part_header_raw), - result_to_bytes(bytes, stream.data), + let mut binary_part = Part { + headers_rfc: std::mem::take(&mut mime_part_header), + headers_raw: std::mem::take(&mut mime_part_header_raw), is_encoding_problem, - ); + body: result_to_bytes(bytes, stream.data), + offset_header: state.offset_header, + offset_body: state.offset_body, + offset_end: state.offset_end, + }; // If there is a single part in the message, move MIME headers // to the part @@ -535,18 +552,19 @@ impl<'x> Message<'x> { } else { add_missing_type(&mut mime_part_header, "message".into(), "rfc822".into()); message.attachments.push(message.parts.len()); - message.parts.push(MessagePart::Message(Part::new( - std::mem::take(&mut mime_part_header), - std::mem::take(&mut mime_part_header_raw), - MessageAttachment::Raw(result_to_bytes(bytes, stream.data)), + message.parts.push(MessagePart::Message(Part { + headers_rfc: std::mem::take(&mut mime_part_header), + headers_raw: std::mem::take(&mut mime_part_header_raw), is_encoding_problem, - ))); + body: MessageAttachment::Raw(result_to_bytes(bytes, stream.data)), + offset_header: state.offset_header, + offset_body: state.offset_body, + offset_end: state.offset_end, + })); } if state.mime_boundary.is_some() { // Currently processing a MIME part - let mut last_part_offset = stream.pos; - 'inner: loop { if let MimeType::Message = state.mime_type { // Finished processing nested message, restore parent message from stack @@ -556,16 +574,22 @@ impl<'x> Message<'x> { ) = (message_stack.pop(), state_stack.pop()) { message.structure = state.get_structure(); - message.offset_end = seek_crlf_end(&stream, last_part_offset); + message.offset_header = state.offset_header; + message.offset_body = state.offset_body; + message.offset_end = + seek_part_end(&stream, stream.pos, state.mime_boundary.as_deref()); message.raw_message = raw_message[message.offset_header..message.offset_end].into(); prev_message.attachments.push(prev_message.parts.len()); - prev_message.parts.push(MessagePart::Message(Part::new( - headers, + prev_message.parts.push(MessagePart::Message(Part { + headers_rfc: headers, headers_raw, - MessageAttachment::Parsed(Box::new(message)), - false, - ))); + is_encoding_problem: false, + offset_header: prev_state.offset_header, + offset_body: prev_state.offset_body, + offset_end: message.offset_end, + body: MessageAttachment::Parsed(Box::new(message)), + })); message = prev_message; prev_state.mime_boundary = state.mime_boundary; state = prev_state; @@ -601,13 +625,23 @@ impl<'x> Message<'x> { } } + // Update end offset + if let Some(part_id) = state.part_id { + if let Some(part) = message.parts.get_mut(part_id) { + if let MessagePart::Multipart(ref mut part) = part { + part.offset_end = seek_crlf(&stream, stream.pos); + } + } else { + debug_assert!(false, "This should not have happened."); + } + } + if let Some(mut prev_state) = state_stack.pop() { // Add headers and substructure to parent part prev_state.structure.push(state.get_structure()); // Restore ancestor's state state = prev_state; - last_part_offset = stream.pos; if let Some(ref mime_boundary) = state.mime_boundary { // Ancestor has a MIME boundary, seek it. @@ -616,6 +650,7 @@ impl<'x> Message<'x> { } } } + break 'outer; } else { skip_crlf(&mut stream); @@ -631,17 +666,22 @@ impl<'x> Message<'x> { while let (Some((mut prev_message, headers, headers_raw)), Some(prev_state)) = (message_stack.pop(), state_stack.pop()) { - message.offset_end = stream.pos; if !message.is_empty() { + message.offset_header = state.offset_header; + message.offset_body = state.offset_body; + message.offset_end = stream.pos; message.structure = state.get_structure(); message.raw_message = raw_message[message.offset_header..message.offset_end].into(); prev_message.attachments.push(prev_message.parts.len()); - prev_message.parts.push(MessagePart::Message(Part::new( - headers, + prev_message.parts.push(MessagePart::Message(Part { + headers_rfc: headers, headers_raw, - MessageAttachment::Parsed(Box::new(message)), - false, - ))); + is_encoding_problem: false, + offset_header: prev_state.offset_header, + offset_body: prev_state.offset_body, + offset_end: message.offset_end, + body: MessageAttachment::Parsed(Box::new(message)), + })); } message = prev_message; state = prev_state; @@ -649,6 +689,8 @@ impl<'x> Message<'x> { message.raw_message = raw_message.into(); message.structure = state.get_structure(); + message.offset_header = state.offset_header; + message.offset_body = state.offset_body; message.offset_end = stream.pos; if !message.is_empty() { @@ -805,4 +847,69 @@ mod tests { } } }*/ + + /*#[test] + fn raw_parts() { + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("tests"); + test_dir.push("rfc"); + test_dir.push("002.txt"); + let mut input = fs::read(&test_dir).unwrap(); + let mut pos = 0; + + /*let mut input = Vec::with_capacity(input_.len()); + for ch in &input_ { + if ch == &b'\r' { + continue; + } else if ch == &b'\n' { + input.push(b'\r'); + } + input.push(*ch); + }*/ + for sep_pos in 0..input.len() { + if input[sep_pos..sep_pos + SEPARATOR.len()].eq(SEPARATOR) { + pos = sep_pos; + break; + } + } + + let (raw_message, other) = input.split_at_mut(pos); + let message = Message::parse(raw_message).unwrap(); + print_stuff(&message, raw_message); + } + + fn print_stuff(message: &Message, raw_message: &[u8]) { + for (pos, part) in message.parts.iter().enumerate() { + let (start, mid, end) = part.raw_offsets(); + + println!( + "part {}, header {:?}\ncontent: {:?}\nrealcontent: {:?}\n", + pos, + std::str::from_utf8(&raw_message[start..mid]).unwrap(), + std::str::from_utf8(&raw_message[mid..end]).unwrap(), + match part { + MessagePart::Text(text) | MessagePart::Html(text) => text.body.clone(), + MessagePart::Binary(bin) | MessagePart::InlineBinary(bin) => + String::from_utf8_lossy(&bin.body), + MessagePart::Message(_) | MessagePart::Multipart(_) => "".into(), + } + ); + if let MessagePart::Message(sub) = part { + println!("---- FROM ----"); + match &sub.body { + crate::MessageAttachment::Parsed(message) => { + println!( + "coco {:?}", + std::str::from_utf8(message.raw_message.as_ref()).unwrap() + ); + print_stuff(message, raw_message); + } + crate::MessageAttachment::Raw(raw) => { + print_stuff(&Message::parse(raw.as_ref()).unwrap(), raw); + } + } + println!("---- TO ----"); + } + } + }*/ } diff --git a/src/parsers/mime.rs b/src/parsers/mime.rs index 413f80f..2851557 100644 --- a/src/parsers/mime.rs +++ b/src/parsers/mime.rs @@ -150,3 +150,38 @@ pub fn seek_crlf_end(stream: &MessageStream, mut start_pos: usize) -> usize { } start_pos } + +#[inline(always)] +pub fn seek_crlf(stream: &MessageStream, mut start_pos: usize) -> usize { + for ch in &stream.data[start_pos..] { + match ch { + b'\r' | b' ' | b'\t' => start_pos += 1, + b'\n' => { + start_pos += 1; + break; + } + _ => break, + } + } + + start_pos +} + +#[inline(always)] +pub fn seek_part_end( + stream: &MessageStream, + mut start_pos: usize, + boundary: Option<&[u8]>, +) -> usize { + if let Some(boundary) = boundary { + start_pos = start_pos.saturating_sub(boundary.len()); + if let Some(ch) = stream.data.get(start_pos - 1) { + if *ch == b'\r' { + start_pos = start_pos.saturating_sub(1); + } + } + start_pos + } else { + start_pos + } +} diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index 7a2c627..341b92f 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -25,6 +25,12 @@ Content-Type: application/x-whatever ---- EXPECTED STRUCTURE ----{ "headers_rfc": { + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, "date": { "DateTime": { "year": 1993, @@ -44,6 +50,12 @@ Content-Type: application/x-whatever "mime_version": { "Text": "1.0" }, + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -52,20 +64,64 @@ Content-Type: application/x-whatever "boundary": "boundary42" } } - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 46 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 49, + "end": 79 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 84, + "end": 123 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 131, + "end": 152 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 165, + "end": 170 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 183, + "end": 227 + } + ] + ], "html_body": [ 0 ], @@ -90,8 +146,22 @@ Content-Type: application/x-whatever } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 254, + "end": 284 + } + ] + ], "is_encoding_problem": false, - "body": "... plain text version of message goes here ...\n" + "body": "... plain text version of message goes here ...\n", + "offset_header": 241, + "offset_body": 285, + "offset_end": 333 } }, { @@ -105,8 +175,22 @@ Content-Type: application/x-whatever } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 360, + "end": 375 + } + ] + ], "is_encoding_problem": false, - "body": "... RFC 1896 text/enriched version of same message\n goes here ...\n" + "body": "... RFC 1896 text/enriched version of same message\n goes here ...\n", + "offset_header": 347, + "offset_body": 376, + "offset_end": 445 } }, { @@ -120,6 +204,17 @@ Content-Type: application/x-whatever } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 472, + "end": 496 + } + ] + ], "is_encoding_problem": false, "body": [ 46, @@ -173,7 +268,10 @@ Content-Type: application/x-whatever 46, 46, 10 - ] + ], + "offset_header": 459, + "offset_body": 497, + "offset_end": 548 } } ], diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index ef8a57d..159942e 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -25,23 +25,26 @@ This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ----{ "headers_rfc": { - "subject": { - "Text": "Sample message" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, "from": { "Address": { "name": "Nathaniel Borenstein", "address": "nsb@bellcore.com" } }, - "mime_version": { - "Text": "1.0" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "simple boundary" + } + } + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } }, "date": { "DateTime": { @@ -56,16 +59,69 @@ This is the epilogue. It is also to be ignored. "tz_minute": 0 } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "simple boundary" - } - } + "subject": { + "Text": "Sample message" + }, + "mime_version": { + "Text": "1.0" } }, + "headers_raw": [ + [ + { + "Rfc": "from" + }, + { + "start": 5, + "end": 46 + } + ], + [ + { + "Rfc": "to" + }, + { + "start": 49, + "end": 79 + } + ], + [ + { + "Rfc": "date" + }, + { + "start": 84, + "end": 123 + } + ], + [ + { + "Rfc": "subject" + }, + { + "start": 131, + "end": 147 + } + ], + [ + { + "Rfc": "mime_version" + }, + { + "start": 160, + "end": 165 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 178, + "end": 223 + } + ] + ], "html_body": [ 0, 1 @@ -87,8 +143,12 @@ This is the epilogue. It is also to be ignored. } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak." + "body": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak.", + "offset_header": 400, + "offset_body": 401, + "offset_end": 480 } }, { @@ -104,8 +164,22 @@ This is the epilogue. It is also to be ignored. } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 512, + "end": 542 + } + ] + ], "is_encoding_problem": false, - "body": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n" + "body": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n", + "offset_header": 499, + "offset_body": 543, + "offset_end": 619 } } ], diff --git a/tests/rfc/007.txt b/tests/rfc/007.txt index 0fd6642..03567ce 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -86,6 +86,26 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "subject" + }, + { + "start": 8, + "end": 37 + } + ], + [ + { + "Rfc": "content_type" + }, + { + "start": 50, + "end": 81 + } + ] + ], "html_body": [ 0, 8, @@ -109,23 +129,46 @@ K { "Text": { "headers_rfc": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 99, + "end": 111 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 131, + "end": 139 + } + ] + ], "is_encoding_problem": false, - "body": "A" + "body": "A", + "offset_header": 86, + "offset_body": 140, + "offset_end": 141 } }, { @@ -140,7 +183,21 @@ K } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 161, + "end": 192 + } + ] + ], + "offset_header": 148, + "offset_body": 193, + "offset_end": 801 } }, { @@ -155,7 +212,21 @@ K } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 210, + "end": 247 + } + ] + ], + "offset_header": 197, + "offset_body": 248, + "offset_end": 634 } }, { @@ -170,29 +241,66 @@ K } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 265, + "end": 296 + } + ] + ], + "offset_header": 252, + "offset_body": 297, + "offset_end": 487 } }, { "Text": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, "content_disposition": { "ContentType": { "c_type": "inline", "c_subtype": null, "attributes": null } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 314, + "end": 326 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 346, + "end": 354 + } + ] + ], "is_encoding_problem": false, - "body": "B" + "body": "B", + "offset_header": 301, + "offset_body": 355, + "offset_end": 356 } }, { @@ -213,10 +321,33 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 376, + "end": 388 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 408, + "end": 416 + } + ] + ], "is_encoding_problem": false, "body": [ 67 - ] + ], + "offset_header": 363, + "offset_body": 417, + "offset_end": 418 } }, { @@ -237,8 +368,31 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 438, + "end": 450 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 470, + "end": 478 + } + ] + ], "is_encoding_problem": false, - "body": "D" + "body": "D", + "offset_header": 425, + "offset_body": 479, + "offset_end": 480 } }, { @@ -253,7 +407,21 @@ K } } } - } + }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 506, + "end": 539 + } + ] + ], + "offset_header": 493, + "offset_body": 540, + "offset_end": 626 } }, { @@ -267,8 +435,22 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 557, + "end": 568 + } + ] + ], "is_encoding_problem": false, - "body": "E" + "body": "E", + "offset_header": 544, + "offset_body": 569, + "offset_end": 583 } }, { @@ -282,10 +464,24 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 603, + "end": 615 + } + ] + ], "is_encoding_problem": false, "body": [ 70 - ] + ], + "offset_header": 590, + "offset_body": 616, + "offset_end": 617 } }, { @@ -306,10 +502,33 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 655, + "end": 667 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 687, + "end": 699 + } + ] + ], "is_encoding_problem": false, "body": [ 71 - ] + ], + "offset_header": 642, + "offset_body": 700, + "offset_end": 701 } }, { @@ -323,10 +542,24 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 721, + "end": 742 + } + ] + ], "is_encoding_problem": false, "body": [ 72 - ] + ], + "offset_header": 708, + "offset_body": 743, + "offset_end": 744 } }, { @@ -340,6 +573,17 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 764, + "end": 780 + } + ] + ], "is_encoding_problem": false, "body": { "headers_rfc": { @@ -347,6 +591,17 @@ K "Text": "J" } }, + "headers_raw": [ + [ + { + "Rfc": "subject" + }, + { + "start": 789, + "end": 792 + } + ] + ], "html_body": [ 0 ], @@ -366,8 +621,12 @@ K } } }, + "headers_raw": [], "is_encoding_problem": false, - "body": "J" + "body": "J", + "offset_header": 781, + "offset_body": 793, + "offset_end": 794 } } ], @@ -376,8 +635,11 @@ K }, "offset_header": 781, "offset_body": 793, - "offset_end": 798 - } + "offset_end": 794 + }, + "offset_header": 751, + "offset_body": 781, + "offset_end": 794 } }, { @@ -398,8 +660,31 @@ K } } }, + "headers_raw": [ + [ + { + "Rfc": "content_type" + }, + { + "start": 821, + "end": 833 + } + ], + [ + { + "Rfc": "content_disposition" + }, + { + "start": 853, + "end": 861 + } + ] + ], "is_encoding_problem": false, - "body": "K" + "body": "K", + "offset_header": 808, + "offset_body": 862, + "offset_end": 863 } } ],