Compare commits

..
30 Commits
Author SHA1 Message Date
Mauro D cf8de086c7 Added raw_message() function 2023-02-09 00:08:30 +00:00
Mauro D c7ae90b3bf Fixed clippy warnings. 2023-02-08 23:53:08 +00:00
Mauro D bb0e42e13b Minor fixes. 2022-11-30 18:31:07 +00:00
Mauro D 8ff26db481 Renamed body_html and body_text functions. 2022-11-28 13:03:29 +00:00
Mauro D f4424eeefc Removed get_() prefixes (#31) 2022-11-28 12:37:33 +00:00
Rudi HornandRudi Horn c542f8a0db Use modified time instead of created time (#32)
Co-authored-by: Rudi Horn <dyn-git@rudi-horn.de>
2022-11-20 21:08:44 +01:00
Mauro D 26bca49aac base64_decode_stream and quoted_printable_decode_char 2022-11-03 17:24:57 +00:00
Mauro D 58b1bc8966 HeaderName parse function implementation. 2022-10-21 07:15:42 +00:00
Mauro D fbd53cb094 Added additional functionality to DateTime. 2022-10-16 14:01:16 +00:00
Mauro D be32ba64a9 Fixed values of non-RFC headers. 2022-10-14 13:43:29 +00:00
Mauro D 7b08027955 Added len() to PartType. 2022-10-13 16:57:15 +00:00
Mauro D b653d6fa3d Update single byte decoder. 2022-10-13 14:59:32 +00:00
Mauro D 1bf8860da8 Fixed fuzz tests. Removed serde from default features. 2022-10-13 14:28:24 +00:00
Mauro D 6fcc57a3d9 Refactoring or MessageStream to use iterators more efficiently. 2022-10-13 14:09:43 +00:00
Mauro D ef19d20f9c Automatic parsing of base64/qp encoded nested messages. 2022-10-12 15:48:23 +00:00
Mauro D b5af895140 Added helper functions. 2022-10-11 20:20:21 +00:00
Mauro D 7c4db43aca Fixed raw offsets of multipart/* parts to include MIME epilogue. 2022-10-10 07:56:30 +00:00
Mauro D f544f729be Fixed support for empty messages. 2022-10-09 17:16:17 +00:00
Mauro D d9682c2725 Fixed support for empty messages. 2022-10-09 17:15:45 +00:00
Mauro D a1497a95b9 Added ludicrous mode and header parsing helper functions. 2022-10-09 16:36:03 +00:00
Mauro D 4390417247 Added ludicrous mode and header parsing helper functions. 2022-10-08 17:50:08 +00:00
Mauro D 3f2200a718 Base64/QuotedPrintable decoding optimizations. 2022-09-23 13:46:19 +00:00
Mauro D f4b6c946fd Create FUNDING.yml 2022-09-14 17:26:07 +02:00
Mauro D c886cab1a2 v0.6.1 2022-09-09 09:00:23 +00:00
odina c9b21208db Add support for gb2312 charsets (#30) 2022-09-09 10:56:51 +02:00
Mauro D de4aecf9f1 Support for malformed unstructured fields containing encoded words 2022-09-09 08:54:56 +00:00
Mauro D 9794de57c4 Support for malformed unstructured fields containing encoded words 2022-09-09 08:07:10 +00:00
Mauro D b416b0683a Updated Copyright section. 2022-09-08 16:38:05 +00:00
Mauro D f26042b8e6 Removed Cargo.lock 2022-09-08 15:57:09 +00:00
Mauro D c5ce06c586 Support for malformed unstructured fields containing encoded words (#29) 2022-09-08 15:56:30 +00:00
229 changed files with 116384 additions and 3311 deletions
+13
View File
@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: stalwartlabs
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+1
View File
@@ -2,3 +2,4 @@
/test
perf.*
*.svg
Cargo.lock
-18
View File
@@ -1,18 +0,0 @@
stages:
- build
rust-latest:
stage: build
image: rust:latest
script:
- cargo build --verbose
- cargo test --verbose
rust-nightly:
stage: build
image: rustlang/rust:nightly
script:
- cargo build --verbose
- cargo test --verbose
allow_failure: true
-8
View File
@@ -1,8 +0,0 @@
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
+24
View File
@@ -1,3 +1,27 @@
mail-parser 0.8.1
================================
- Added `raw_message()` function.
mail-parser 0.8.0
================================
- Removed get_() prefixes (#31).
- Maildir import: Use modified time instead of created time (#32)
mail-parser 0.7.0
================================
- Base64/QuotedPrintable decoding optimizations.
- Automatic parsing of base64/qp encoded nested messages.
- Refactoring or ``MessageStream`` to use iterators more efficiently.
- Added "ludicrous mode" Cargo option to use some unsafe code for additional performance.
- Fixed support for empty messages.
- Fixed raw offsets of multipart/* parts to include MIME epilogue.
- Fixed values of non-RFC headers.
mail-parser 0.6.1
================================
- Support for malformed unstructured fields containing encoded words (#29).
- Add support for gb2312 charsets (#30).
mail-parser 0.6.0
================================
- Maildir parsing support.
Generated
-357
View File
@@ -1,357 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "android_system_properties"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e"
dependencies = [
"libc",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"serde",
]
[[package]]
name = "bumpalo"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"js-sys",
"num-integer",
"num-traits",
"time",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "encoding_rs"
version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
dependencies = [
"cfg-if",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "iana-time-zone"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"js-sys",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "itoa"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "js-sys"
version = "0.3.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "libc"
version = "0.2.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "mail-parser"
version = "0.6.0"
dependencies = [
"bincode",
"chrono",
"encoding_rs",
"serde",
"serde_json",
"serde_yaml",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
[[package]]
name = "proc-macro2"
version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "serde"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "serde_yaml"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
dependencies = [
"indexmap",
"ryu",
"serde",
"yaml-rust",
]
[[package]]
name = "syn"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi",
"winapi",
]
[[package]]
name = "unicode-ident"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
+8 -4
View File
@@ -1,7 +1,7 @@
[package]
name = "mail-parser"
description = "Fast and robust e-mail parsing library for Rust"
version = "0.6.0"
version = "0.8.1"
edition = "2018"
authors = [ "Stalwart Labs <hello@stalw.art>"]
license = "Apache-2.0 OR MIT"
@@ -10,21 +10,25 @@ homepage = "https://github.com/stalwartlabs/mail-parser"
keywords = ["email", "mime", "mail", "parser", "e-mail"]
categories = ["email", "parser-implementations"]
readme = "README.md"
resolver = "2"
[dependencies]
encoding_rs = {version="0.8", optional=true}
serde = { version = "1.0", features = ["derive"], optional=true}
encoding_rs = { version="0.8", optional=true }
serde = { version = "1.0", features = ["derive"], optional=true }
[dev-dependencies]
mail-parser = { path = ".", features = ["serde_support", "full_encoding"] }
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8" # Version 0.9 fails to parse certain inputs
serde_json = "1.0"
bincode = "1.3.3"
chrono = "0.4"
[features]
default = ["serde_support", "full_encoding"]
default = ["full_encoding"]
full_encoding = ["encoding_rs"]
serde_support = ["serde"]
ludicrous_mode = []
[profile.bench]
debug = true
+13 -17
View File
@@ -79,7 +79,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
// Parses addresses (including comments), lists and groups
assert_eq!(
message.get_from(),
message.from(),
&HeaderValue::Address(Addr::new(
"Art Vandelay (Vandelay Industries)".into(),
"art@vandelay.com"
@@ -87,7 +87,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_to(),
message.to(),
&HeaderValue::GroupList(vec![
Group::new(
"Colleagues",
@@ -104,19 +104,19 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_date().unwrap().to_rfc3339(),
message.date().unwrap().to_rfc3339(),
"2021-11-20T14:22:01-08:00"
);
// RFC2047 support for encoded text in message readers
assert_eq!(
message.get_subject().unwrap(),
message.subject().unwrap(),
"Why not both importing AND exporting? ☺"
);
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
assert_eq!(
message.get_html_body(0).unwrap(),
message.body_html(0).unwrap(),
concat!(
"<html><p>I was thinking about quitting the &ldquo;exporting&rdquo; to ",
"focus just on the &ldquo;importing&rdquo;,</p><p>but then I thought,",
@@ -126,7 +126,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
// HTML parts are converted to plain text (and viceversa) when missing
assert_eq!(
message.get_text_body(0).unwrap(),
message.body_text(0).unwrap(),
concat!(
"I was thinking about quitting the “exporting” to focus just on the",
" “importing”,\nbut then I thought, why not do both? ☺\n"
@@ -135,33 +135,33 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
// Supports nested messages as well as multipart/digest
let nested_message = message
.get_attachment(0)
.attachment(0)
.unwrap()
.get_message();
.message();
.unwrap();
assert_eq!(
nested_message.get_subject().unwrap(),
nested_message.subject().unwrap(),
"Exporting my book about coffee tables"
);
// Handles UTF-* as well as many legacy encodings
assert_eq!(
nested_message.get_text_body(0).unwrap(),
nested_message.body_text(0).unwrap(),
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
);
assert_eq!(
nested_message.get_html_body(0).unwrap(),
nested_message.body_html(0).unwrap(),
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
);
let nested_attachment = nested_message.get_attachment(0).unwrap();
let nested_attachment = nested_message.attachment(0).unwrap();
assert_eq!(nested_attachment.len(), 42);
// Full RFC2231 support for continuations and character sets
assert_eq!(
nested_attachment.get_attachment_name().unwrap(),
nested_attachment.attachment_name().unwrap(),
"Book about ☕ tables.gif"
);
@@ -279,7 +279,3 @@ at your option.
## Copyright
Copyright (C) 2020-2022, Stalwart Labs Ltd.
See [COPYING] for the license.
[COPYING]: https://github.com/stalwartlabs/mail-parser/blob/main/COPYING
+12 -12
View File
@@ -57,7 +57,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
// Parses addresses (including comments), lists and groups
assert_eq!(
message.get_from(),
message.from(),
&HeaderValue::Address(Addr::new(
"Art Vandelay (Vandelay Industries)".into(),
"art@vandelay.com"
@@ -65,7 +65,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_to(),
message.to(),
&HeaderValue::GroupList(vec![
Group::new(
"Colleagues",
@@ -82,19 +82,19 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_date().unwrap().to_rfc3339(),
message.date().unwrap().to_rfc3339(),
"2021-11-20T14:22:01-08:00"
);
// RFC2047 support for encoded text in message readers
assert_eq!(
message.get_subject().unwrap(),
message.subject().unwrap(),
"Why not both importing AND exporting? ☺"
);
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
assert_eq!(
message.get_html_body(0).unwrap(),
message.body_html(0).unwrap(),
concat!(
"<html><p>I was thinking about quitting the &ldquo;exporting&rdquo; to ",
"focus just on the &ldquo;importing&rdquo;,</p><p>but then I thought,",
@@ -104,7 +104,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
// HTML parts are converted to plain text (and viceversa) when missing
assert_eq!(
message.get_text_body(0).unwrap(),
message.body_text(0).unwrap(),
concat!(
"I was thinking about quitting the “exporting” to focus just on the",
" “importing”,\nbut then I thought, why not do both? ☺\n"
@@ -112,30 +112,30 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
// Supports nested messages as well as multipart/digest
let nested_message = message.get_attachment(0).unwrap().get_message().unwrap();
let nested_message = message.attachment(0).unwrap().message().unwrap();
assert_eq!(
nested_message.get_subject().unwrap(),
nested_message.subject().unwrap(),
"Exporting my book about coffee tables"
);
// Handles UTF-* as well as many legacy encodings
assert_eq!(
nested_message.get_text_body(0).unwrap(),
nested_message.body_text(0).unwrap(),
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
);
assert_eq!(
nested_message.get_html_body(0).unwrap(),
nested_message.body_html(0).unwrap(),
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
);
let nested_attachment = nested_message.get_attachment(0).unwrap();
let nested_attachment = nested_message.attachment(0).unwrap();
assert_eq!(nested_attachment.len(), 42);
// Full RFC2231 support for continuations and character sets
assert_eq!(
nested_attachment.get_attachment_name().unwrap(),
nested_attachment.attachment_name().unwrap(),
"Book about ☕ tables.gif"
);
+4 -4
View File
@@ -59,15 +59,15 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
}
fn write_attachments(message: &Message) {
for attachment in message.get_attachments() {
for attachment in message.attachments() {
if !attachment.is_message() {
std::fs::write(
attachment.get_attachment_name().unwrap_or("Untitled"),
attachment.get_contents(),
attachment.attachment_name().unwrap_or("Untitled"),
attachment.contents(),
)
.unwrap();
} else {
write_attachments(&attachment.get_message().unwrap());
write_attachments(attachment.message().unwrap());
}
}
}
+1 -57
View File
@@ -42,10 +42,9 @@ dependencies = [
[[package]]
name = "mail-parser"
version = "0.5.0"
version = "0.8.0"
dependencies = [
"encoding_rs",
"serde",
]
[[package]]
@@ -61,58 +60,3 @@ name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "proc-macro2"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "syn"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+69 -121
View File
@@ -3,141 +3,89 @@ use libfuzzer_sys::fuzz_target;
use mail_parser::{
decoders::{
base64::decode_base64,
base64::base64_decode,
charsets::{
map::get_charset_decoder,
map::charset_decoder,
single_byte::decoder_iso_8859_1,
utf::{decoder_utf16, decoder_utf16_be, decoder_utf16_le, decoder_utf7},
},
encoded_word::decode_rfc2047,
hex::decode_hex,
html::{add_html_token, html_to_text, text_to_html},
quoted_printable::decode_quoted_printable,
quoted_printable::quoted_printable_decode,
},
parsers::{
fields::{
address::parse_address,
content_type::parse_content_type,
date::parse_date,
id::parse_id,
list::parse_comma_separared,
raw::{parse_and_ignore, parse_raw},
thread::{thread_name, trim_trailing_fwd},
unstructured::parse_unstructured,
},
header::parse_header_name,
message::MessageStream,
mime::*,
fields::thread::{thread_name, trim_trailing_fwd},
MessageStream,
},
Message,
};
static RFC822_ALPHABET: &[u8] = b"0123456789abcdefghijklm:=- \r\n";
fuzz_target!(|data: &[u8]| {
// Fuzz every parsing function
for n_fuzz in 1..=24 {
let mut stream = MessageStream::new(&data);
for data_ in [
std::borrow::Cow::from(data),
std::borrow::Cow::from(into_alphabet(data, RFC822_ALPHABET)),
] {
let data = data_.as_ref();
match n_fuzz {
1 => {
parse_date(&mut stream);
}
2 => {
parse_address(&mut stream);
}
3 => {
parse_id(&mut stream);
}
4 => {
parse_comma_separared(&mut stream);
}
5 => {
parse_and_ignore(&mut stream);
}
6 => {
parse_raw(&mut stream);
}
7 => {
parse_unstructured(&mut stream);
}
8 => {
parse_content_type(&mut stream);
}
9 => {
parse_header_name(&data);
}
10 => {
decode_rfc2047(&mut stream, 0);
}
11 => {
seek_next_part(&mut stream, b"\n");
}
12 => {
get_bytes_to_boundary(&mut stream, 0, b"\n", false);
}
13 => {
get_bytes_to_boundary(&mut stream, 0, &[], false);
}
14 => {
skip_crlf(&mut stream);
}
15 => {
is_boundary_end(&mut stream, 0);
}
16 => {
skip_multipart_end(&mut stream);
}
17 => {
decode_base64(&mut stream, 0, b"\n", true);
}
18 => {
decode_base64(&mut stream, 0, b"\n", false);
}
19 => {
decode_base64(&mut stream, 0, &[], true);
}
20 => {
decode_base64(&mut stream, 0, &[], false);
}
21 => {
decode_quoted_printable(&mut stream, 0, b"\n\n", true); // QP Boundaries have to be at least 2 bytes long
}
22 => {
decode_quoted_printable(&mut stream, 0, b"\n\n", false); // QP Boundaries have to be at least 2 bytes long
}
23 => {
decode_quoted_printable(&mut stream, 0, &[], true);
}
24 => {
decode_quoted_printable(&mut stream, 0, &[], false);
}
0 | 25..=u32::MAX => unreachable!(),
// Fuzz every parsing function
MessageStream::new(data).parse_date();
MessageStream::new(data).parse_address();
MessageStream::new(data).parse_id();
MessageStream::new(data).parse_comma_separared();
MessageStream::new(data).parse_and_ignore();
MessageStream::new(data).parse_raw();
MessageStream::new(data).parse_unstructured();
MessageStream::new(data).parse_content_type();
MessageStream::new(data).parse_headers(&mut Vec::new());
MessageStream::new(data).parse_header_name();
MessageStream::new(data).decode_rfc2047();
MessageStream::new(data).seek_next_part(b"\n");
MessageStream::new(data).mime_part(b"\n");
MessageStream::new(data).seek_part_end(b"\n"[..].into());
MessageStream::new(data).skip_crlf();
MessageStream::new(data).is_multipart_end();
base64_decode(data);
MessageStream::new(data).decode_base64_word();
MessageStream::new(data).decode_base64_mime(b"\n");
quoted_printable_decode(data);
MessageStream::new(data).decode_quoted_printable_word();
MessageStream::new(data).decode_quoted_printable_mime(b"\n");
// Fuzz text functions
let mut html_str = String::with_capacity(data.len());
let str_data = String::from_utf8_lossy(data);
add_html_token(&mut html_str, str_data.as_ref().as_bytes(), false);
html_to_text(&str_data);
text_to_html(&str_data);
thread_name(&str_data);
trim_trailing_fwd(&str_data);
// Fuzz decoding functions
decode_hex(data);
charset_decoder(data);
for decoder in &[
decoder_utf7,
decoder_utf16_le,
decoder_utf16_be,
decoder_utf16,
decoder_iso_8859_1,
] as &[for<'x> fn(&'x [u8]) -> String]
{
decoder(data);
}
// Fuzz the entire library
Message::parse(data);
}
// Fuzz text functions
let mut html_str = String::with_capacity(data.len());
let str_data = String::from_utf8_lossy(data);
add_html_token(&mut html_str, str_data.as_ref().as_bytes(), false);
html_to_text(&str_data);
text_to_html(&str_data);
thread_name(&str_data);
trim_trailing_fwd(&str_data);
// Fuzz decoding functions
decode_hex(data);
get_charset_decoder(data);
for decoder in &[
decoder_utf7,
decoder_utf16_le,
decoder_utf16_be,
decoder_utf16,
decoder_iso_8859_1,
] as &[for<'x> fn(&'x [u8]) -> String]
{
decoder(data);
}
// Fuzz the entire library
Message::parse(&data[..]);
});
fn into_alphabet(data: &[u8], alphabet: &[u8]) -> Vec<u8> {
data.iter()
.map(|&byte| alphabet[byte as usize % alphabet.len()])
.collect()
}
+313 -125
View File
@@ -9,185 +9,373 @@
* except according to those terms.
*/
use crate::parsers::message::MessageStream;
use std::borrow::Cow;
use super::DecodeResult;
use crate::parsers::MessageStream;
pub fn decode_base64<'x>(
stream: &MessageStream<'x>,
start_pos: usize,
boundary: &[u8],
is_word: bool,
) -> (usize, DecodeResult) {
let mut success = boundary.is_empty();
#[inline(always)]
pub fn base64_decode(bytes: &[u8]) -> Option<Vec<u8>> {
base64_decode_stream(bytes.iter(), bytes.len(), u8::MAX)
}
pub fn base64_decode_stream<'x>(
stream: impl Iterator<Item = &'x u8>,
stream_len: usize,
stop_char: u8,
) -> Option<Vec<u8>> {
let mut chunk: u32 = 0;
let mut byte_count: u8 = 0;
let mut match_count: usize = 0;
let mut bytes_read = 0;
let mut buf = Vec::with_capacity(stream_len / 4 * 3);
let mut buf = Vec::with_capacity(stream.data.len() - start_pos);
for &ch in stream {
#[cfg(feature = "ludicrous_mode")]
let val = unsafe {
*BASE64_MAP
.get_unchecked(byte_count as usize)
.get_unchecked(ch as usize)
};
#[cfg(not(feature = "ludicrous_mode"))]
let val = BASE64_MAP[byte_count as usize][ch as usize];
for ch in stream.data[start_pos..].iter() {
bytes_read += 1;
if val < 0x01ffffff {
byte_count = (byte_count + 1) & 3;
if !success {
if *ch == boundary[match_count] {
match_count += 1;
if match_count == boundary.len() {
success = true;
break;
} else {
continue;
}
} else if match_count > 0 {
if *ch == boundary[0] {
match_count = 1;
continue;
} else {
match_count = 0;
if byte_count == 1 {
chunk = val;
} else {
chunk |= val;
if byte_count == 0 {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..3));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..3]);
}
}
}
let val = BASE64_MAP[byte_count as usize][*ch as usize];
if val >= 0x01ffffff {
if *ch == b'=' {
match byte_count {
} else {
match ch {
b'=' => match byte_count {
1 | 2 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.push(*chunk.to_le_bytes().get_unchecked(0));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.push(chunk.to_le_bytes()[0]);
byte_count = 0;
}
3 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..2));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..2]);
byte_count = 0;
}
0 => (),
_ => {
success = false;
break;
return None;
}
}
} else if !ch.is_ascii_whitespace() || is_word {
success = false;
break;
}
continue;
}
byte_count = (byte_count + 1) & 3;
if byte_count == 1 {
chunk = val;
} else {
chunk |= val;
if byte_count == 0 {
buf.extend_from_slice(&chunk.to_le_bytes()[0..3]);
},
b' ' | b'\t' | b'\r' | b'\n' => (),
_ => return if ch == stop_char { buf.into() } else { None },
}
}
}
(
if success { bytes_read } else { 0 },
if !buf.is_empty() {
buf.shrink_to_fit();
DecodeResult::Owned(buf)
} else {
DecodeResult::Empty
},
)
buf.into()
}
impl<'x> MessageStream<'x> {
pub fn decode_base64_mime(&mut self, boundary: &[u8]) -> (usize, Cow<'x, [u8]>) {
let mut chunk: u32 = 0;
let mut byte_count: u8 = 0;
let mut buf = Vec::with_capacity(self.remaining() / 4 * 3);
let mut last_ch = b'\n';
let mut before_last_ch = 0;
let mut end_pos = self.offset();
self.checkpoint();
while let Some(&ch) = self.next() {
#[cfg(feature = "ludicrous_mode")]
let val = unsafe {
*BASE64_MAP
.get_unchecked(byte_count as usize)
.get_unchecked(ch as usize)
};
#[cfg(not(feature = "ludicrous_mode"))]
let val = BASE64_MAP[byte_count as usize][ch as usize];
if val < 0x01ffffff {
byte_count = (byte_count + 1) & 3;
if byte_count == 1 {
chunk = val;
} else {
chunk |= val;
if byte_count == 0 {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..3));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..3]);
}
}
} else {
match ch {
b'=' => match byte_count {
1 | 2 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.push(*chunk.to_le_bytes().get_unchecked(0));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.push(chunk.to_le_bytes()[0]);
byte_count = 0;
}
3 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..2));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..2]);
byte_count = 0;
}
0 => (),
_ => {
self.restore();
return (usize::MAX, b""[..].into());
}
},
b'\n' => {
end_pos = if last_ch == b'\r' {
self.offset() - 2
} else {
self.offset() - 1
}
}
b' ' | b'\t' | b'\r' => (),
b'-' => {
if last_ch == b'-' {
return if !boundary.is_empty() && self.try_skip(boundary) {
buf.shrink_to_fit();
(
if before_last_ch == b'\n' {
end_pos
} else {
self.offset() - boundary.len() - 2
},
buf.into(),
)
} else {
self.restore();
(usize::MAX, b""[..].into())
};
}
}
_ => {
self.restore();
return (usize::MAX, b""[..].into());
}
}
}
before_last_ch = last_ch;
last_ch = ch;
}
buf.shrink_to_fit();
(
if boundary.is_empty() {
self.offset()
} else {
self.restore();
usize::MAX
},
buf.into(),
)
}
pub fn decode_base64_word(&mut self) -> Option<Vec<u8>> {
let mut chunk: u32 = 0;
let mut byte_count: u8 = 0;
let mut buf = Vec::with_capacity(64);
while let Some(&ch) = self.next() {
match ch {
b'=' => {
match byte_count {
1 | 2 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.push(*chunk.to_le_bytes().get_unchecked(0));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.push(chunk.to_le_bytes()[0]);
byte_count = 0;
}
3 => {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..2));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..2]);
byte_count = 0;
}
0 => (),
_ => {
// Invalid
break;
}
}
}
b'?' => {
if let Some(b'=') = self.next() {
return Some(buf);
} else {
break;
}
}
b'\n' => {
if !self.next_is_space() {
break;
}
}
b' ' | b'\t' | b'\r' => (),
_ => {
#[cfg(feature = "ludicrous_mode")]
let val = unsafe {
*BASE64_MAP
.get_unchecked(byte_count as usize)
.get_unchecked(ch as usize)
};
#[cfg(not(feature = "ludicrous_mode"))]
let val = BASE64_MAP[byte_count as usize][ch as usize];
if val < 0x01ffffff {
byte_count = (byte_count + 1) & 3;
if byte_count == 1 {
chunk = val;
} else {
chunk |= val;
if byte_count == 0 {
#[cfg(feature = "ludicrous_mode")]
unsafe {
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..3));
}
#[cfg(not(feature = "ludicrous_mode"))]
buf.extend_from_slice(&chunk.to_le_bytes()[0..3]);
}
}
} else {
break;
}
}
}
}
None
}
}
#[cfg(test)]
mod tests {
use crate::{
decoders::{base64::decode_base64, DecodeResult},
parsers::message::MessageStream,
};
use crate::parsers::MessageStream;
#[test]
fn decode_base64_strings() {
let inputs = [
("VGVzdA==", "Test", "", true),
("WWU=", "Ye", "", true),
("QQ==", "A", "", true),
("cm8=", "ro", "", true),
fn decode_base64() {
for (encoded_str, expected_result) in [
("VGVzdA==", "Test"),
("WWU=", "Ye"),
("QQ==", "A"),
("cm8=", "ro"),
(
"QXJlIHlvdSBhIFNoaW1hbm8gb3IgQ2FtcGFnbm9sbyBwZXJzb24/",
"Are you a Shimano or Campagnolo person?",
"",
true,
),
(
"PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPC9ib2R5Pgo8L2h0bWw+Cg==",
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
"",
true,
),
(
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==",
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
"",
false,
),
("w6HDqcOtw7PDug==", "áéíóú"),
("====", ""),
("w6HDq!cOtw7PDug=", ""),
("w6 HD qcOt", "áéí"),
("cmáé", ""),
("áé", ""),
("w\n6\nH\nD\nq\nc\nO\nt\nw\n7\n P\tD u g\n==", "áéíóú"),
("w6HDqcOtw7PDug==", "áéíóú"),
] {
assert_eq!(
super::base64_decode(encoded_str.as_bytes()).unwrap_or_default(),
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
}
}
#[test]
fn decode_base64_mime() {
for (encoded_str, expected_result) in [
("VGVzdA==\r\n--boundary\n", "Test"),
(
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==",
"",
"",
true,
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==\r\n--boundary--\r\n",
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
),
("w6HDqcOtw7PDug==\r\n--boundary \n", "áéíóú"),
("w\n6\nH\nD\nq\nc\nO\nt\nw\n7\n P\tD u g\n==\r\n--boundary\n", "áéíóú"),
("w6HDqcOtw7PDug==--boundary", "áéíóú"),
(
"w6HDqcOtw7PDug==\n--boundary--",
"áéíóú",
),
("w6HDqcOtw7PDug==", "áéíóú", "", true),
("====", "", "\n--boundary", true),
("w6HDq!cOtw7PDug=", "", "", true),
("w6 HD", "", "", true),
("cmáé", "", "", true),
("áé", "", "", true),
("w6HDqcOtw7PDug==?=", "áéíóú", "?=", true),
(
"w\n6\nH\nD\nq\nc\nO\nt\nw\n7\n P\tD u g\n==\n--boundary",
"áéíóú",
"\n--boundary",
false,
),
("w6HDqcOtw7PDug================?=", "áéíóú", "?=", false),
(
"w6HDqcOtw7PDug==\n--\n--boundary",
"áéíóú",
"\n--boundary",
false,
),
];
] {
let mut s = MessageStream::new(encoded_str.as_bytes());
let (_, result) = s.decode_base64_mime(b"boundary");
for input in inputs {
let str = input.0.to_string();
let stream = MessageStream::new(str.as_bytes());
let (bytes_read, result) = decode_base64(&stream, 0, input.2.as_bytes(), input.3);
assert_eq!(
bytes_read > 0,
!input.1.is_empty(),
"Failed for '{:?}'",
input.0
result,
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
}
}
if !input.1.is_empty() {
let bytes = match result {
DecodeResult::Owned(v) => v,
_ => unreachable!(),
};
let result_str = std::str::from_utf8(&bytes).unwrap();
//println!("'{}' -> '{}'", input.0.escape_debug(), result_str.escape_debug());
assert_eq!(
result_str,
input.1,
"Failed for '{}'",
input.0.escape_debug()
);
}
#[test]
fn decode_base64_word() {
for (encoded_str, expected_result) in [
("w 6 H D q c O t w 7 P D u g== ?=", "áéíóú"),
("w6HDqcOtw7PDug==?=", "áéíóú"),
("w6HDqc\n Otw7PDug==?=", "áéíóú"),
("w6HDqcOtw7PDug================?=", "áéíóú"),
("?=", ""),
] {
let mut s = MessageStream::new(encoded_str.as_bytes());
assert_eq!(
s.decode_base64_word().unwrap(),
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
}
}
}
+40 -11
View File
@@ -16,7 +16,7 @@ use super::{
DecoderFnc,
};
pub fn get_charset_decoder(charset: &[u8]) -> Option<DecoderFnc> {
pub fn charset_decoder(charset: &[u8]) -> Option<DecoderFnc> {
if (2..=45).contains(&charset.len()) {
let mut l_charset = [0u8; 45];
let mut hash: u32 = charset.len() as u32;
@@ -29,19 +29,47 @@ pub fn get_charset_decoder(charset: &[u8]) -> Option<DecoderFnc> {
};
l_charset[pos] = ch;
if let 0 | 3 | 6 | 7 | 8 | 9 = pos {
hash += CH_HASH[ch as usize];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*CH_HASH.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
CH_HASH[ch as usize]
};
}
if pos == charset.len() - 1 {
hash += CH_HASH[ch as usize];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*CH_HASH.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
CH_HASH[ch as usize]
};
}
}
if (7..=764).contains(&hash) {
let hash = (hash - 7) as usize;
let ch_map = CH_MAP[hash];
let ch_map = {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*CH_MAP.get_unchecked(hash)
}
#[cfg(not(feature = "ludicrous_mode"))]
CH_MAP[hash]
};
if l_charset[..charset.len()].eq(ch_map) {
return Some(FNC_MAP[hash]);
return Some({
#[cfg(feature = "ludicrous_mode")]
unsafe {
*FNC_MAP.get_unchecked(hash)
}
#[cfg(not(feature = "ludicrous_mode"))]
FNC_MAP[hash]
});
}
}
}
@@ -55,10 +83,11 @@ pub fn no_op(_bytes: &[u8]) -> String {
#[cfg(test)]
mod tests {
use super::get_charset_decoder;
use super::charset_decoder;
#[test]
fn get_decoder_charset() {
#[allow(clippy::uninlined_format_args)]
fn decoder_charset() {
let inputs = [
"l8",
//"utf-8",
@@ -71,8 +100,8 @@ mod tests {
for input in inputs {
assert!(
get_charset_decoder(input.as_bytes()).is_some(),
"Failed for '{}'",
charset_decoder(input.as_bytes()).is_some(),
"Failed for {}",
input
);
}
@@ -477,7 +506,7 @@ static CH_MAP: &[&[u8]; 758] = &[
b"",
b"",
b"iso-ir-127",
b"",
b"gb2312",
b"",
b"",
b"",
@@ -1239,7 +1268,7 @@ static FNC_MAP: &[for<'x> fn(&'x [u8]) -> String; 758] = &[
no_op,
no_op,
decoder_iso_8859_6,
no_op,
decoder_gb18030,
no_op,
no_op,
no_op,
+2 -2
View File
@@ -18,7 +18,7 @@ pub type DecoderFnc = fn(&[u8]) -> String;
#[cfg(test)]
mod tests {
use super::map::get_charset_decoder;
use super::map::charset_decoder;
#[test]
fn decode_charset() {
@@ -65,7 +65,7 @@ mod tests {
];
for input in inputs {
let decoder = get_charset_decoder(input.0.as_bytes())
let decoder = charset_decoder(input.0.as_bytes())
.expect(&("Failed to find decoder for ".to_owned() + input.0));
assert_eq!(decoder(&input.1), input.2);
+5
View File
@@ -13,6 +13,11 @@ fn single_byte_decoder(table: &[char], bytes: &[u8]) -> String {
let mut result = String::with_capacity(bytes.len() * 2);
for byte in bytes {
#[cfg(feature = "ludicrous_mode")]
unsafe {
result.push(*table.get_unchecked(*byte as usize));
}
#[cfg(not(feature = "ludicrous_mode"))]
result.push(table[*byte as usize]);
}
+89 -111
View File
@@ -9,11 +9,9 @@
* except according to those terms.
*/
use crate::{decoders::charsets::map::get_charset_decoder, parsers::message::MessageStream};
use crate::{decoders::charsets::map::charset_decoder, parsers::MessageStream};
use super::{
base64::decode_base64, quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult,
};
use super::DecodeWordFnc;
enum Rfc2047State {
Init,
@@ -22,179 +20,159 @@ enum Rfc2047State {
Data,
}
pub fn decode_rfc2047(stream: &MessageStream, start_pos: usize) -> (usize, Option<String>) {
let mut read_pos: usize = start_pos;
let mut state = Rfc2047State::Init;
impl<'x> MessageStream<'x> {
pub fn decode_rfc2047(&mut self) -> Option<String> {
let mut state = Rfc2047State::Init;
let mut charset_start = 0;
let mut charset_end = 0;
let mut decode_fnc: Option<DecodeFnc> = None;
let mut charset_start = 0;
let mut charset_end = 0;
let mut decode_fnc: Option<DecodeWordFnc> = None;
for ch in stream.data[start_pos..].iter() {
read_pos += 1;
match state {
Rfc2047State::Init => {
if ch != &b'?' {
return (0, None);
}
state = Rfc2047State::Charset;
charset_start = read_pos;
charset_end = read_pos;
}
Rfc2047State::Charset => match ch {
b'?' => {
if charset_end == charset_start {
charset_end = read_pos - 1;
while let Some(ch) = self.next() {
match state {
Rfc2047State::Init => {
if ch != &b'?' {
return None;
}
if (charset_end - charset_start) < 2 {
return (0, None);
state = Rfc2047State::Charset;
charset_start = self.offset();
charset_end = self.offset();
}
Rfc2047State::Charset => match ch {
b'?' => {
if charset_end == charset_start {
charset_end = self.offset() - 1;
}
if (charset_end - charset_start) < 2 {
return None;
}
state = Rfc2047State::Encoding;
}
state = Rfc2047State::Encoding;
}
b'*' => {
if charset_end == charset_start {
charset_end = read_pos - 1;
b'*' => {
if charset_end == charset_start {
charset_end = self.offset() - 1;
}
}
}
b'\n' => {
return (0, None);
}
_ => (),
},
Rfc2047State::Encoding => {
match ch {
b'q' | b'Q' => decode_fnc = Some(decode_quoted_printable),
b'b' | b'B' => decode_fnc = Some(decode_base64),
_ => {
return (0, None);
b'\n' => {
return None;
}
}
state = Rfc2047State::Data;
}
Rfc2047State::Data => {
if ch != &b'?' {
return (0, None);
} else {
break;
}
}
}
}
if let Some(decode_fnc) = decode_fnc {
if let (bytes_read @ 1..=usize::MAX, DecodeResult::Owned(bytes)) =
decode_fnc(stream, read_pos, b"?=", true)
{
return (
(read_pos - start_pos) + bytes_read,
if let Some(decoder) = get_charset_decoder(&stream.data[charset_start..charset_end])
{
decoder(&bytes).into()
} else {
String::from_utf8(bytes)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into()
_ => (),
},
);
Rfc2047State::Encoding => {
match ch {
b'q' | b'Q' => {
decode_fnc = Some(MessageStream::decode_quoted_printable_word)
}
b'b' | b'B' => decode_fnc = Some(MessageStream::decode_base64_word),
_ => {
return None;
}
}
state = Rfc2047State::Data;
}
Rfc2047State::Data => {
if ch != &b'?' {
return None;
} else {
break;
}
}
}
}
if let Some(bytes) = decode_fnc.and_then(|fnc| fnc(self)) {
if let Some(decoder) = charset_decoder(self.bytes(charset_start..charset_end)) {
decoder(&bytes).into()
} else {
String::from_utf8(bytes)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into()
}
} else {
None
}
}
(0, None)
}
#[cfg(test)]
mod tests {
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream};
use crate::parsers::MessageStream;
#[test]
fn decode_rfc2047_string() {
let inputs = [
fn decode_rfc2047() {
for (input, expected_result, _) in [
(
"?iso-8859-1?q?this=20is=20some=20text?=".to_string(),
"?iso-8859-1?q?this=20is=20some=20text?=",
"this is some text",
true,
),
(
"?iso-8859-1?q?this is some text?=".to_string(),
"?iso-8859-1?q?this is some text?=",
"this is some text",
true,
),
("?US-ASCII?Q?Keith_Moore?=", "Keith Moore", false),
(
"?US-ASCII?Q?Keith_Moore?=".to_string(),
"Keith Moore",
false,
),
(
"?iso_8859-1:1987?Q?Keld_J=F8rn_Simonsen?=".to_string(),
"?iso_8859-1:1987?Q?Keld_J=F8rn_Simonsen?=",
"Keld Jørn Simonsen",
true,
),
(
"?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=".to_string(),
"?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=",
"If you can read this yo",
true,
),
(
"?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=".to_string(),
"?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=",
"u understand the example.",
true,
),
("?ISO-8859-1?Q?Olle_J=E4rnefors?=", "Olle Järnefors", true),
(
"?ISO-8859-1?Q?Olle_J=E4rnefors?=".to_string(),
"Olle Järnefors",
true,
),
(
"?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=".to_string(),
"?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=",
"Patrik Fältström",
true,
),
("?ISO-8859-1*?Q?a?=".to_string(), "a", true),
("?ISO-8859-1**?Q?a_b?=".to_string(), "a b", true),
("?ISO-8859-1*?Q?a?=", "a", true),
("?ISO-8859-1**?Q?a_b?=", "a b", true),
(
"?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=".to_string(),
"?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=",
"Thís ís válíd ÚTF8",
false,
),
(
"?utf-8*unknown?q?Th=C3=ADs_=C3=ADs_v=C3=A1l=C3=ADd_=C3=9ATF8?=".to_string(),
"?utf-8*unknown?q?Th=C3=ADs_=C3=ADs_v=C3=A1l=C3=ADd_=C3=9ATF8?=",
"Thís ís válíd ÚTF8",
false,
),
(
"?Iso-8859-6?Q?=E5=D1=CD=C8=C7 =C8=C7=E4=D9=C7=E4=E5?=".to_string(),
"?Iso-8859-6?Q?=E5=D1=CD=C8=C7 =C8=C7=E4=D9=C7=E4=E5?=",
"مرحبا بالعالم",
true,
),
(
"?Iso-8859-6*arabic?b?5dHNyMcgyMfk2cfk5Q==?=".to_string(),
"?Iso-8859-6*arabic?b?5dHNyMcgyMfk2cfk5Q==?=",
"مرحبا بالعالم",
true,
),
#[cfg(feature = "full_encoding")]
(
"?shift_jis?B?g26DjYFbgUWDj4Fbg4uDaA==?=".to_string(),
"?shift_jis?B?g26DjYFbgUWDj4Fbg4uDaA==?=",
"ハロー・ワールド",
true,
),
#[cfg(feature = "full_encoding")]
(
"?iso-2022-jp?q?=1B$B%O%m!<!&%o!<%k%I=1B(B?=".to_string(),
"?iso-2022-jp?q?=1B$B%O%m!<!&%o!<%k%I=1B(B?=",
"ハロー・ワールド",
true,
),
];
for input in inputs {
let str = input.0.to_string();
match decode_rfc2047(&MessageStream::new(str.as_bytes()), 0) {
(_, Some(string)) => {
] {
match MessageStream::new(input.as_bytes()).decode_rfc2047() {
Some(result) => {
//println!("Decoded '{}'", string);
assert_eq!(string, input.1);
assert_eq!(result, expected_result);
}
_ => panic!("Failed to decode '{}'", input.0),
_ => panic!("Failed to decode '{}'", input),
}
}
}
+51 -9
View File
@@ -33,29 +33,71 @@ pub fn add_html_token(result: &mut String, token: &[u8], add_space: bool) {
debug_assert_eq!(ENTITY_HASH.len(), u8::MAX as usize + 5);
debug_assert_eq!(ENTITY_MAP.len(), 18079 - 64 + 1);
for (pos, ch) in entity.iter().enumerate() {
for (pos, &ch) in entity.iter().enumerate() {
match pos {
0 | 5 | 6 | 9 | 11 => {
hash += ENTITY_HASH[*ch as usize];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_HASH.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_HASH[ch as usize]
};
}
1 => {
hash += ENTITY_HASH[*ch as usize + 4];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_HASH.get_unchecked(ch as usize + 4)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_HASH[ch as usize + 4]
};
}
2 | 4 => {
hash += ENTITY_HASH[*ch as usize + 1];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_HASH.get_unchecked(ch as usize + 1)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_HASH[ch as usize + 1]
};
}
3 => {
hash += ENTITY_HASH[*ch as usize + 3];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_HASH.get_unchecked(ch as usize + 3)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_HASH[ch as usize + 3]
};
}
_ => (),
}
if pos == entity.len() - 1 {
hash += ENTITY_HASH[*ch as usize];
hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_HASH.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_HASH[ch as usize]
};
}
}
if (64..=18079).contains(&hash) {
entity_code = ENTITY_MAP[(hash - 64) as usize];
entity_code = {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*ENTITY_MAP.get_unchecked((hash - 64) as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
ENTITY_MAP[(hash - 64) as usize]
};
}
}
@@ -221,12 +263,12 @@ pub fn text_to_html(input: &str) -> String {
result.extend_from_slice(b"<html><body>");
for ch in input {
for &ch in input {
match ch {
b'\n' => result.extend_from_slice(b"<br/>"),
b'<' => result.extend_from_slice(b"&lt;"),
b'\r' => (),
_ => result.push(*ch),
_ => result.push(ch),
}
}
result.extend_from_slice(b"</body></html>");
+5 -8
View File
@@ -9,7 +9,9 @@
* except according to those terms.
*/
use crate::parsers::message::MessageStream;
use std::borrow::Cow;
use crate::parsers::MessageStream;
pub mod base64;
pub mod charsets;
@@ -18,10 +20,5 @@ pub mod hex;
pub mod html;
pub mod quoted_printable;
pub type DecodeFnc<'x> = fn(&MessageStream<'x>, usize, &[u8], bool) -> (usize, DecodeResult);
pub enum DecodeResult {
Owned(Vec<u8>),
Borrowed((usize, usize)),
Empty,
}
pub type DecodeFnc<'x> = fn(&mut MessageStream<'x>, &[u8]) -> (usize, Cow<'x, [u8]>);
pub type DecodeWordFnc<'x> = fn(&mut MessageStream<'x>) -> Option<Vec<u8>>;
+321 -184
View File
@@ -9,9 +9,9 @@
* except according to those terms.
*/
use crate::parsers::message::MessageStream;
use std::borrow::Cow;
use super::DecodeResult;
use crate::parsers::MessageStream;
#[derive(PartialEq, Debug)]
enum QuotedPrintableState {
@@ -20,158 +20,277 @@ enum QuotedPrintableState {
Hex1,
}
pub fn decode_quoted_printable<'x>(
stream: &MessageStream<'x>,
start_pos: usize,
boundary: &[u8],
is_word: bool,
) -> (usize, DecodeResult) {
let mut success = boundary.is_empty();
let mut bytes_read = 0;
let mut buf = Vec::with_capacity(stream.data.len() - start_pos);
pub fn quoted_printable_decode(bytes: &[u8]) -> Option<Vec<u8>> {
let mut buf = Vec::with_capacity(bytes.len());
let mut state = QuotedPrintableState::None;
let mut match_count = 0;
let mut hex1 = 0;
let mut lf_pos = 0;
debug_assert!(boundary.is_empty() || boundary.len() >= 2);
for ch in stream.data[start_pos..].iter() {
bytes_read += 1;
// if success is false, a boundary was provided
if !success {
let mut is_boundary_end = true;
if *ch == boundary[match_count] {
match_count += 1;
if match_count == boundary.len() {
let done = if is_word {
true
} else {
is_boundary_end =
crate::parsers::mime::is_boundary_end(stream, start_pos + bytes_read);
if is_boundary_end && bytes_read - boundary.len() == lf_pos {
buf.pop();
}
is_boundary_end
};
if done {
success = true;
break;
}
} else {
continue;
}
}
if match_count > 0 {
if QuotedPrintableState::Eq != state {
for ch in boundary[..match_count].iter() {
buf.push(*ch);
}
}
state = QuotedPrintableState::None;
// is_boundary_end is always true except in the rare event
// that a boundary was found without a proper MIME ending (-- or \r\n)
if is_boundary_end {
if *ch == boundary[0] {
// Char matched beginning of boundary, get next char.
match_count = 1;
continue;
} else {
// Reset match count and decode character
match_count = 0;
}
} else {
// There was a full boundary match but without a proper MIME
// ending, reset match count and continue.
match_count = 0;
continue;
}
}
}
for &ch in bytes {
match ch {
b'=' => {
if let QuotedPrintableState::None = state {
state = QuotedPrintableState::Eq
} else {
success = false;
break;
return None;
}
}
b'\n' => {
if is_word {
success = false;
break;
} else if QuotedPrintableState::Eq == state {
if QuotedPrintableState::Eq == state {
state = QuotedPrintableState::None;
} else {
buf.push(b'\n');
lf_pos = bytes_read;
}
}
b'_' if is_word => {
buf.push(b' ');
}
b'\r' => (),
_ => match state {
QuotedPrintableState::None => {
buf.push(*ch);
buf.push(ch);
}
QuotedPrintableState::Eq => {
hex1 = HEX_MAP[*ch as usize];
hex1 = {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HEX_MAP.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HEX_MAP[ch as usize]
};
if hex1 != -1 {
state = QuotedPrintableState::Hex1;
} else {
success = false;
break;
return None;
}
}
QuotedPrintableState::Hex1 => {
let hex2 = HEX_MAP[*ch as usize];
#[cfg(feature = "ludicrous_mode")]
let hex2 = unsafe { *HEX_MAP.get_unchecked(ch as usize) };
#[cfg(not(feature = "ludicrous_mode"))]
let hex2 = HEX_MAP[ch as usize];
state = QuotedPrintableState::None;
if hex2 != -1 {
let ch = ((hex1 as u8) << 4) | hex2 as u8;
buf.push(ch);
buf.push(((hex1 as u8) << 4) | hex2 as u8);
} else {
success = false;
break;
return None;
}
}
},
}
}
(
if success { bytes_read } else { 0 },
if !buf.is_empty() {
buf.shrink_to_fit();
DecodeResult::Owned(buf)
} else {
DecodeResult::Empty
},
)
buf.into()
}
#[inline(always)]
pub fn quoted_printable_decode_char(hex1: u8, hex2: u8) -> Option<u8> {
#[cfg(feature = "ludicrous_mode")]
{
let hex1 = unsafe { *HEX_MAP.get_unchecked(hex1 as usize) };
let hex2 = unsafe { *HEX_MAP.get_unchecked(hex2 as usize) };
if hex1 != -1 && hex2 != -1 {
(((hex1 as u8) << 4) | hex2 as u8).into()
} else {
None
}
}
#[cfg(not(feature = "ludicrous_mode"))]
{
let hex1 = HEX_MAP[hex1 as usize];
let hex2 = HEX_MAP[hex2 as usize];
if hex1 != -1 && hex2 != -1 {
(((hex1 as u8) << 4) | hex2 as u8).into()
} else {
None
}
}
}
impl<'x> MessageStream<'x> {
pub fn decode_quoted_printable_mime(&mut self, boundary: &[u8]) -> (usize, Cow<'x, [u8]>) {
let mut buf = Vec::with_capacity(128);
let mut state = QuotedPrintableState::None;
let mut hex1 = 0;
let mut last_ch = 0;
let mut before_last_ch = 0;
let mut end_pos = self.offset();
self.checkpoint();
while let Some(&ch) = self.next() {
match ch {
b'=' => {
if let QuotedPrintableState::None = state {
state = QuotedPrintableState::Eq
} else {
self.restore();
return (usize::MAX, b""[..].into());
}
}
b'\n' => {
end_pos = if last_ch == b'\r' {
self.offset() - 2
} else {
self.offset() - 1
};
if QuotedPrintableState::Eq == state {
state = QuotedPrintableState::None;
} else {
buf.push(b'\n');
}
}
b'\r' => (),
b'-' if !boundary.is_empty() && last_ch == b'-' && self.try_skip(boundary) => {
if before_last_ch == b'\n' {
buf.truncate(buf.len() - 2);
} else {
buf.truncate(buf.len() - 1);
end_pos = self.offset() - boundary.len() - 2;
}
return (end_pos, buf.into());
}
_ => match state {
QuotedPrintableState::None => {
buf.push(ch);
}
QuotedPrintableState::Eq => {
hex1 = {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HEX_MAP.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HEX_MAP[ch as usize]
};
if hex1 != -1 {
state = QuotedPrintableState::Hex1;
} else {
self.restore();
return (usize::MAX, b""[..].into());
}
}
QuotedPrintableState::Hex1 => {
#[cfg(feature = "ludicrous_mode")]
let hex2 = unsafe { *HEX_MAP.get_unchecked(ch as usize) };
#[cfg(not(feature = "ludicrous_mode"))]
let hex2 = HEX_MAP[ch as usize];
state = QuotedPrintableState::None;
if hex2 != -1 {
buf.push(((hex1 as u8) << 4) | hex2 as u8);
} else {
self.restore();
return (usize::MAX, b""[..].into());
}
}
},
}
before_last_ch = last_ch;
last_ch = ch;
}
(
if boundary.is_empty() {
self.offset()
} else {
self.restore();
usize::MAX
},
buf.into(),
)
}
pub fn decode_quoted_printable_word(&mut self) -> Option<Vec<u8>> {
let mut buf = Vec::with_capacity(64);
let mut state = QuotedPrintableState::None;
let mut hex1 = 0;
while let Some(&ch) = self.next() {
match ch {
b'=' => {
if let QuotedPrintableState::None = state {
state = QuotedPrintableState::Eq
} else {
break;
}
}
b'?' => {
if let Some(b'=') = self.peek() {
self.next();
return buf.into();
} else {
buf.push(b'?');
}
}
b'\n' => {
if let Some(b' ' | b'\t') = self.peek() {
loop {
self.next();
if !self.peek_next_is_space() {
break;
}
}
} else {
break;
}
}
b'_' => {
buf.push(b' ');
}
b'\r' => (),
_ => match state {
QuotedPrintableState::None => {
buf.push(ch);
}
QuotedPrintableState::Eq => {
hex1 = {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HEX_MAP.get_unchecked(ch as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HEX_MAP[ch as usize]
};
if hex1 != -1 {
state = QuotedPrintableState::Hex1;
} else {
// Failed
break;
}
}
QuotedPrintableState::Hex1 => {
#[cfg(feature = "ludicrous_mode")]
let hex2 = unsafe { *HEX_MAP.get_unchecked(ch as usize) };
#[cfg(not(feature = "ludicrous_mode"))]
let hex2 = HEX_MAP[ch as usize];
state = QuotedPrintableState::None;
if hex2 != -1 {
buf.push(((hex1 as u8) << 4) | hex2 as u8);
} else {
// Failed
break;
}
}
},
}
}
None
}
}
#[cfg(test)]
mod tests {
use crate::{
decoders::{quoted_printable::decode_quoted_printable, DecodeResult},
parsers::message::MessageStream,
};
use crate::parsers::MessageStream;
#[test]
fn decode_quoted_printable_string() {
let inputs = [
fn decode_quoted_printable() {
for (encoded_str, expected_result) in [
(
concat!(
"J'interdis aux marchands de vanter trop leurs marchandises. ",
@@ -190,26 +309,10 @@ mod tests {
"est vulgaire ils te fabriquent pour te la vendre une âme vulgaire.\n",
"— Antoine de Saint-Exupéry, Citadelle (1948)"
),
"",
false,
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--boundary",
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry",
"— Antoine de Saint-Exupéry",
"--boundary",
false,
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--\n--boundary",
"— Antoine de Saint-Exupéry\n--",
"--boundary",
false,
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry=\n--\n--boundary",
"— Antoine de Saint-Exupéry--",
"--boundary",
false,
),
(
concat!(
@@ -222,70 +325,104 @@ mod tests {
"sprach ein Redner, \"in steter Furcht vor Menschen und ",
"Tieren, eine Beute der Hunde, der\n"
),
"",
false,
),
("this=20is=20some=20text?=", "this is some text", "?=", true),
("this is some text?=", "this is some text", "?=", true),
("Keith_Moore?=", "Keith Moore", "?=", true),
("=2=123?=", "", "?=", true),
("= 20?=", "", "?=", true),
("=====?=", "", "?=", true),
("=20=20=XX?=", "", "?=", true),
("=AX?=", "", "?=", true),
("=\n=\n==?=", "", "?=", true),
("=\r=1z?=", "", "?=", true),
("=|?=", "", "?=", true),
("????????=", "???????", "?=", true),
];
("\n\n", "\n\n"),
] {
assert_eq!(
super::quoted_printable_decode(encoded_str.as_bytes()).unwrap_or_default(),
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
}
}
for input in inputs {
let str = input.0.to_string();
let stream = MessageStream::new(str.as_bytes());
let (bytes_read, result) =
decode_quoted_printable(&stream, 0, input.2.as_bytes(), input.3);
#[test]
fn decode_quoted_printable_mime() {
for (encoded_str, expected_result) in [
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--boundary",
"— Antoine de Saint-Exupéry",
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--\n--boundary",
"— Antoine de Saint-Exupéry\n--",
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry=\n--\n--boundary",
"— Antoine de Saint-Exupéry--",
),
(
concat!(
"J'interdis aux marchands de vanter trop leurs marchandises. ",
"Car ils se font=\nvite p=C3=A9dagogues et t'enseignent comme but ce ",
"qui n'est par essence qu=\n'un moyen, et te trompant ainsi sur la route ",
"=C3=A0 suivre les voil=C3=\n=A0 bient=C3=B4t qui te d=C3=A9gradent, car ",
"si leur musique est vulgaire il=\ns te fabriquent pour te la vendre une ",
"=C3=A2me vulgaire.\n=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry, ",
"Citadelle (1948)\r\n--boundary--"
),
concat!(
"J'interdis aux marchands de vanter trop leurs marchandises. ",
"Car ils se fontvite pédagogues et t'enseignent comme but ce qui ",
"n'est par essence qu'un moyen, et te trompant ainsi sur la route ",
"à suivre les voilà bientôt qui te dégradent, car si leur musique ",
"est vulgaire ils te fabriquent pour te la vendre une âme vulgaire.\n",
"— Antoine de Saint-Exupéry, Citadelle (1948)"
),
),
(
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--\n--boundary",
"— Antoine de Saint-Exupéry\n--",
),
(
concat!(
"Die Hasen klagten einst uber ihre Lage; \"wir ",
"leben\", sprach ein=\r\n Redner, \"in steter Furcht vor Menschen",
" und Tieren, eine Beute der Hunde,=\r\n der\n\r\n--boundary \n"
),
concat!(
"Die Hasen klagten einst uber ihre Lage; \"wir leben\", ",
"sprach ein Redner, \"in steter Furcht vor Menschen und ",
"Tieren, eine Beute der Hunde, der\n"
),
),
] {
let mut s = MessageStream::new(encoded_str.as_bytes());
let (_, result) = s.decode_quoted_printable_mime(b"boundary");
assert_eq!(
bytes_read > 0,
!input.1.is_empty(),
"Failed for '{:?}'",
input.0
result,
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
if !input.1.is_empty() {
let bytes = match result {
DecodeResult::Owned(v) => v,
_ => unreachable!(),
};
let result_str = std::str::from_utf8(&bytes).unwrap();
/*println!(
"Decoded '{}'\n -> to ->\n'{}'\n{}",
input.0.escape_debug(),
result_str.escape_debug(),
"-".repeat(50)
);*/
assert_eq!(
input.1,
result_str,
"Failed for '{}'",
input.0.escape_debug()
);
}
}
}
// MIRI overflow tests
for input in [b"\x0a\x0a\x00\x0b".to_vec(), b":B\x0a%".to_vec()] {
let stream = MessageStream::new(&input[..]);
decode_quoted_printable(&stream, 0, b"\n\n", true);
let stream = MessageStream::new(&input[..]);
decode_quoted_printable(&stream, 0, b"\n\n", false);
let stream = MessageStream::new(&input[..]);
decode_quoted_printable(&stream, 0, &[], true);
let stream = MessageStream::new(&input[..]);
decode_quoted_printable(&stream, 0, &[], false);
#[test]
fn decode_quoted_printable_word() {
for (encoded_str, expected_result) in [
("this=20is=20some=20text?=", "this is some text"),
("this=20is=20\n some=20text?=", "this is some text"),
("this is some text?=", "this is some text"),
("Keith_Moore?=", "Keith Moore"),
("=2=123?=", ""),
("= 20?=", ""),
("=====?=", ""),
("=20=20=XX?=", ""),
("=AX?=", ""),
("=\n=\n==?=", ""),
("=\r=1z?=", ""),
("=|?=", ""),
("????????=", "???????"),
("\n\n", ""),
] {
let mut s = MessageStream::new(encoded_str.as_bytes());
assert_eq!(
s.decode_quoted_printable_word().unwrap_or_default(),
expected_result.as_bytes(),
"Failed for {encoded_str:?}",
);
}
}
}
+375 -227
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -197,7 +197,7 @@ impl Iterator for MessageIterator {
if let Some(name) = path.file_name().and_then(|name| name.to_str()) {
if !name.starts_with('.') {
let internal_date =
match fs::metadata(&path).and_then(|m| m.created()).and_then(|d| {
match fs::metadata(&path).and_then(|m| m.modified()).and_then(|d| {
d.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs())
.map_err(|e| {
+390 -320
View File
@@ -11,10 +11,7 @@
use std::borrow::Cow;
use crate::{
decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, Addr, Group,
HeaderValue,
};
use crate::{parsers::MessageStream, Addr, Group, HeaderValue};
#[derive(PartialEq, Clone, Copy, Debug)]
enum AddressState {
@@ -45,45 +42,336 @@ pub struct AddressParser<'x> {
result: Vec<Group<'x>>,
}
pub fn add_token<'x>(
parser: &mut AddressParser<'x>,
stream: &MessageStream<'x>,
add_trail_space: bool,
) {
if parser.token_start > 0 {
let token = String::from_utf8_lossy(&stream.data[parser.token_start - 1..parser.token_end]);
let mut add_space = false;
let list = match parser.state {
AddressState::Address => &mut parser.mail_tokens,
AddressState::Name => {
if parser.is_token_email {
&mut parser.mail_tokens
} else {
add_space = true;
&mut parser.name_tokens
impl<'x> AddressParser<'x> {
pub fn add_token(&mut self, stream: &MessageStream<'x>, add_trail_space: bool) {
if self.token_start > 0 {
let token = String::from_utf8_lossy(&stream.data[self.token_start - 1..self.token_end]);
let mut add_space = false;
let list = match self.state {
AddressState::Address => &mut self.mail_tokens,
AddressState::Name => {
if self.is_token_email {
&mut self.mail_tokens
} else {
add_space = true;
&mut self.name_tokens
}
}
AddressState::Quote => &mut self.name_tokens,
AddressState::Comment => {
add_space = true;
&mut self.comment_tokens
}
};
if add_space && !list.is_empty() {
list.push(" ".into());
}
AddressState::Quote => &mut parser.name_tokens,
AddressState::Comment => {
add_space = true;
&mut parser.comment_tokens
list.push(token);
if add_trail_space {
list.push(" ".into());
}
self.token_start = 0;
self.is_token_email = false;
self.is_token_start = true;
self.is_escaped = false;
}
}
pub fn add_address(&mut self) {
let has_mail = !self.mail_tokens.is_empty();
let has_name = !self.name_tokens.is_empty();
let has_comment = !self.comment_tokens.is_empty();
self.addresses.push(if has_mail && has_name && has_comment {
Addr {
name: Some(
format!(
"{} ({})",
concat_tokens(&mut self.name_tokens),
concat_tokens(&mut self.comment_tokens)
)
.into(),
),
address: concat_tokens(&mut self.mail_tokens).into(),
}
} else if has_name && has_mail {
Addr {
name: concat_tokens(&mut self.name_tokens).into(),
address: concat_tokens(&mut self.mail_tokens).into(),
}
} else if has_mail && has_comment {
Addr {
name: concat_tokens(&mut self.comment_tokens).into(),
address: concat_tokens(&mut self.mail_tokens).into(),
}
} else if has_mail {
Addr {
name: None,
address: concat_tokens(&mut self.mail_tokens).into(),
}
} else if has_name && has_comment {
Addr {
name: concat_tokens(&mut self.comment_tokens).into(),
address: concat_tokens(&mut self.name_tokens).into(),
}
} else if has_name {
Addr {
name: concat_tokens(&mut self.name_tokens).into(),
address: None,
}
} else if has_comment {
Addr {
name: concat_tokens(&mut self.comment_tokens).into(),
address: None,
}
} else {
return;
});
}
pub fn add_group_details(&mut self) {
if !self.name_tokens.is_empty() {
self.group_name = concat_tokens(&mut self.name_tokens).into();
}
if !self.comment_tokens.is_empty() {
self.group_comment = concat_tokens(&mut self.comment_tokens).into();
}
if !self.mail_tokens.is_empty() {
if self.group_name.is_none() {
self.group_name = concat_tokens(&mut self.mail_tokens).into();
} else {
self.group_name = Some(
(self.group_name.as_ref().unwrap().as_ref().to_owned()
+ " "
+ concat_tokens(&mut self.mail_tokens).as_ref())
.into(),
);
}
}
}
pub fn add_group(&mut self) {
let has_name = self.group_name.is_some();
let has_comment = self.group_comment.is_some();
let has_addresses = !self.addresses.is_empty();
self.result
.push(if has_name && has_addresses && has_comment {
Group {
name: Some(
format!(
"{} ({})",
self.group_name.take().unwrap(),
self.group_comment.take().unwrap()
)
.into(),
),
addresses: std::mem::take(&mut self.addresses),
}
} else if has_addresses && has_name {
Group {
name: self.group_name.take(),
addresses: std::mem::take(&mut self.addresses),
}
} else if has_addresses {
Group {
name: self.group_comment.take(),
addresses: std::mem::take(&mut self.addresses),
}
} else if has_name {
Group {
name: self.group_name.take(),
addresses: Vec::new(),
}
} else {
return;
});
}
}
impl<'x> MessageStream<'x> {
pub fn parse_address(&mut self) -> HeaderValue<'x> {
let mut parser = AddressParser {
token_start: 0,
token_end: 0,
is_token_email: false,
is_token_start: true,
is_escaped: false,
name_tokens: Vec::with_capacity(3),
mail_tokens: Vec::with_capacity(3),
comment_tokens: Vec::with_capacity(3),
state: AddressState::Name,
state_stack: Vec::with_capacity(5),
addresses: Vec::new(),
group_name: None,
group_comment: None,
result: Vec::new(),
};
if add_space && !list.is_empty() {
list.push(" ".into());
while let Some(ch) = self.next() {
match ch {
b'\n' => {
parser.add_token(self, false);
if self.try_next_is_space() {
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
} else {
break;
}
}
b'\\' if parser.state != AddressState::Name => {
if parser.token_start > 0 {
if parser.state == AddressState::Quote {
parser.token_end = self.offset() - 1;
}
parser.add_token(self, false);
}
parser.is_escaped = true;
continue;
}
b',' if parser.state == AddressState::Name => {
parser.add_token(self, false);
parser.add_address();
continue;
}
b'<' if parser.state == AddressState::Name => {
parser.add_token(self, false);
parser.state_stack.push(AddressState::Name);
parser.state = AddressState::Address;
continue;
}
b'>' if parser.state == AddressState::Address => {
parser.add_token(self, false);
parser.state = parser.state_stack.pop().unwrap();
continue;
}
b'"' if !parser.is_escaped => match parser.state {
AddressState::Name => {
parser.state_stack.push(AddressState::Name);
parser.state = AddressState::Quote;
parser.add_token(self, false);
continue;
}
AddressState::Quote => {
parser.add_token(self, false);
parser.state = parser.state_stack.pop().unwrap();
continue;
}
_ => (),
},
b'@' if parser.state == AddressState::Name => {
parser.is_token_email = true;
}
b'=' if parser.is_token_start && !parser.is_escaped && self.peek_char(b'?') => {
self.checkpoint();
if let Some(token) = self.decode_rfc2047() {
let add_space = parser.state != AddressState::Quote; // Make borrow-checker happy
parser.add_token(self, add_space);
(if parser.state != AddressState::Comment {
&mut parser.name_tokens
} else {
&mut parser.comment_tokens
})
.push(token.into());
continue;
}
self.restore();
}
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.state == AddressState::Quote {
if parser.token_start == 0 {
parser.token_start = self.offset();
parser.token_end = parser.token_start;
} else {
parser.token_end = self.offset();
}
}
continue;
}
b'\r' => continue,
b'(' if parser.state != AddressState::Quote && !parser.is_escaped => {
parser.state_stack.push(parser.state);
if parser.state != AddressState::Comment {
parser.add_token(self, false);
parser.state = AddressState::Comment;
continue;
}
}
b')' if parser.state == AddressState::Comment && !parser.is_escaped => {
let new_state = parser.state_stack.pop().unwrap();
if parser.state != new_state {
parser.add_token(self, false);
parser.state = new_state;
continue;
}
}
b':' if parser.state == AddressState::Name && !parser.is_escaped => {
parser.add_group();
parser.add_token(self, false);
parser.add_group_details();
continue;
}
b';' if parser.state == AddressState::Name => {
parser.add_token(self, false);
parser.add_address();
parser.add_group();
continue;
}
_ => (),
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = self.offset();
parser.token_end = parser.token_start;
} else {
parser.token_end = self.offset();
}
}
list.push(token);
parser.add_address();
if add_trail_space {
list.push(" ".into());
if parser.group_name.is_some() || !parser.result.is_empty() {
parser.add_group();
if parser.result.len() > 1 {
HeaderValue::GroupList(parser.result)
} else {
HeaderValue::Group(parser.result.pop().unwrap())
}
} else if !parser.addresses.is_empty() {
if parser.addresses.len() > 1 {
HeaderValue::AddressList(parser.addresses)
} else {
HeaderValue::Address(parser.addresses.pop().unwrap())
}
} else {
HeaderValue::Empty
}
parser.token_start = 0;
parser.is_token_email = false;
parser.is_token_start = true;
parser.is_escaped = false;
}
}
@@ -97,312 +385,94 @@ fn concat_tokens<'x>(tokens: &mut Vec<Cow<'x, str>>) -> Cow<'x, str> {
}
}
pub fn add_address(parser: &mut AddressParser) {
let has_mail = !parser.mail_tokens.is_empty();
let has_name = !parser.name_tokens.is_empty();
let has_comment = !parser.comment_tokens.is_empty();
pub fn parse_address_local_part(addr: &str) -> Option<&str> {
let addr = addr.as_bytes();
let mut iter = addr.iter().enumerate();
while let Some((pos, &ch)) = iter.next() {
if ch == b'@' {
return if pos > 0 && iter.next().is_some() {
std::str::from_utf8(addr.get(..pos)?).ok()
} else {
None
};
} else if !ch.is_ascii() {
return None;
}
}
parser
.addresses
.push(if has_mail && has_name && has_comment {
Addr {
name: Some(
format!(
"{} ({})",
concat_tokens(&mut parser.name_tokens),
concat_tokens(&mut parser.comment_tokens)
)
.into(),
),
address: concat_tokens(&mut parser.mail_tokens).into(),
}
} else if has_name && has_mail {
Addr {
name: concat_tokens(&mut parser.name_tokens).into(),
address: concat_tokens(&mut parser.mail_tokens).into(),
}
} else if has_mail && has_comment {
Addr {
name: concat_tokens(&mut parser.comment_tokens).into(),
address: concat_tokens(&mut parser.mail_tokens).into(),
}
} else if has_mail {
Addr {
name: None,
address: concat_tokens(&mut parser.mail_tokens).into(),
}
} else if has_name && has_comment {
Addr {
name: concat_tokens(&mut parser.comment_tokens).into(),
address: concat_tokens(&mut parser.name_tokens).into(),
}
} else if has_name {
Addr {
name: concat_tokens(&mut parser.name_tokens).into(),
address: None,
}
} else if has_comment {
Addr {
name: concat_tokens(&mut parser.comment_tokens).into(),
address: None,
}
} else {
return;
});
None
}
pub fn add_group_details(parser: &mut AddressParser) {
if !parser.name_tokens.is_empty() {
parser.group_name = concat_tokens(&mut parser.name_tokens).into();
}
if !parser.comment_tokens.is_empty() {
parser.group_comment = concat_tokens(&mut parser.comment_tokens).into();
}
if !parser.mail_tokens.is_empty() {
if parser.group_name.is_none() {
parser.group_name = concat_tokens(&mut parser.mail_tokens).into();
} else {
parser.group_name = Some(
(parser.group_name.as_ref().unwrap().as_ref().to_owned()
+ " "
+ concat_tokens(&mut parser.mail_tokens).as_ref())
.into(),
);
pub fn parse_address_domain(addr: &str) -> Option<&str> {
let addr = addr.as_bytes();
for (pos, &ch) in addr.iter().enumerate() {
if ch == b'@' {
return if pos > 0 && pos + 1 < addr.len() {
std::str::from_utf8(addr.get(pos + 1..)?).ok()
} else {
None
};
} else if !ch.is_ascii() {
return None;
}
}
None
}
pub fn add_group(parser: &mut AddressParser) {
let has_name = parser.group_name.is_some();
let has_comment = parser.group_comment.is_some();
let has_addresses = !parser.addresses.is_empty();
pub fn parse_address_user_part(addr: &str) -> Option<&str> {
let addr = addr.as_bytes();
parser
.result
.push(if has_name && has_addresses && has_comment {
Group {
name: Some(
format!(
"{} ({})",
parser.group_name.take().unwrap(),
parser.group_comment.take().unwrap()
)
.into(),
),
addresses: std::mem::take(&mut parser.addresses),
let mut iter = addr.iter().enumerate();
while let Some((pos, &ch)) = iter.next() {
if ch == b'+' {
if pos > 0 {
while let Some((_, &ch)) = iter.next() {
if ch == b'@' && iter.next().is_some() {
return std::str::from_utf8(addr.get(..pos)?).ok();
}
}
}
} else if has_addresses && has_name {
Group {
name: parser.group_name.take(),
addresses: std::mem::take(&mut parser.addresses),
}
} else if has_addresses {
Group {
name: parser.group_comment.take(),
addresses: std::mem::take(&mut parser.addresses),
}
} else if has_name {
Group {
name: parser.group_name.take(),
addresses: Vec::new(),
}
} else {
return;
});
return None;
} else if ch == b'@' {
return if pos > 0 && iter.next().is_some() {
std::str::from_utf8(addr.get(..pos)?).ok()
} else {
None
};
} else if !ch.is_ascii() {
return None;
}
}
None
}
pub fn parse_address<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut parser = AddressParser {
token_start: 0,
token_end: 0,
pub fn parse_address_detail_part(addr: &str) -> Option<&str> {
let addr = addr.as_bytes();
let mut plus_pos = usize::MAX;
is_token_email: false,
is_token_start: true,
is_escaped: false,
name_tokens: Vec::with_capacity(3),
mail_tokens: Vec::with_capacity(3),
comment_tokens: Vec::with_capacity(3),
state: AddressState::Name,
state_stack: Vec::with_capacity(5),
addresses: Vec::new(),
group_name: None,
group_comment: None,
result: Vec::new(),
};
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b'\n' => {
add_token(&mut parser, stream, false);
match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
iter.next();
stream.pos += 1;
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
}
_ => break,
}
let mut iter = addr.iter().enumerate();
while let Some((pos, &ch)) = iter.next() {
if ch == b'+' {
plus_pos = pos + 1;
} else if ch == b'@' {
if plus_pos != usize::MAX && iter.next().is_some() {
return std::str::from_utf8(addr.get(plus_pos..pos)?).ok();
} else {
return None;
}
b'\\' if parser.state != AddressState::Name => {
if parser.token_start > 0 {
if parser.state == AddressState::Quote {
parser.token_end = stream.pos - 1;
}
add_token(&mut parser, stream, false);
}
parser.is_escaped = true;
continue;
}
b',' if parser.state == AddressState::Name => {
add_token(&mut parser, stream, false);
add_address(&mut parser);
continue;
}
b'<' if parser.state == AddressState::Name => {
add_token(&mut parser, stream, false);
parser.state_stack.push(AddressState::Name);
parser.state = AddressState::Address;
continue;
}
b'>' if parser.state == AddressState::Address => {
add_token(&mut parser, stream, false);
parser.state = parser.state_stack.pop().unwrap();
continue;
}
b'"' if !parser.is_escaped => match parser.state {
AddressState::Name => {
parser.state_stack.push(AddressState::Name);
parser.state = AddressState::Quote;
add_token(&mut parser, stream, false);
continue;
}
AddressState::Quote => {
add_token(&mut parser, stream, false);
parser.state = parser.state_stack.pop().unwrap();
continue;
}
_ => (),
},
b'@' if parser.state == AddressState::Name => {
parser.is_token_email = true;
}
b'=' if parser.is_token_start && !parser.is_escaped => {
if let (d_bytes_read, Some(token)) = decode_rfc2047(stream, stream.pos) {
let add_space = parser.state != AddressState::Quote; // Make borrow-checker happy
add_token(&mut parser, stream, add_space);
(if parser.state != AddressState::Comment {
&mut parser.name_tokens
} else {
&mut parser.comment_tokens
})
.push(token.into());
stream.pos += d_bytes_read;
iter = stream.data[stream.pos..].iter();
continue;
}
}
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.state == AddressState::Quote {
if parser.token_start == 0 {
parser.token_start = stream.pos;
parser.token_end = parser.token_start;
} else {
parser.token_end = stream.pos;
}
}
continue;
}
b'\r' => continue,
b'(' if parser.state != AddressState::Quote && !parser.is_escaped => {
parser.state_stack.push(parser.state);
if parser.state != AddressState::Comment {
add_token(&mut parser, stream, false);
parser.state = AddressState::Comment;
continue;
}
}
b')' if parser.state == AddressState::Comment && !parser.is_escaped => {
let new_state = parser.state_stack.pop().unwrap();
if parser.state != new_state {
add_token(&mut parser, stream, false);
parser.state = new_state;
continue;
}
}
b':' if parser.state == AddressState::Name && !parser.is_escaped => {
add_group(&mut parser);
add_token(&mut parser, stream, false);
add_group_details(&mut parser);
continue;
}
b';' if parser.state == AddressState::Name => {
add_token(&mut parser, stream, false);
add_address(&mut parser);
add_group(&mut parser);
continue;
}
_ => (),
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = stream.pos;
parser.token_end = parser.token_start;
} else {
parser.token_end = stream.pos;
} else if !ch.is_ascii() {
return None;
}
}
add_address(&mut parser);
if parser.group_name.is_some() || !parser.result.is_empty() {
add_group(&mut parser);
if parser.result.len() > 1 {
HeaderValue::GroupList(parser.result)
} else {
HeaderValue::Group(parser.result.pop().unwrap())
}
} else if !parser.addresses.is_empty() {
if parser.addresses.len() > 1 {
HeaderValue::AddressList(parser.addresses)
} else {
HeaderValue::Address(parser.addresses.pop().unwrap())
}
} else {
HeaderValue::Empty
}
None
}
mod tests {
#[test]
fn parse_addresses() {
use crate::parsers::fields::address::parse_address;
use super::*;
let inputs = [
@@ -923,7 +993,7 @@ mod tests {
for input in inputs {
let str = input.0.to_string();
let result = parse_address(&mut MessageStream::new(str.as_bytes()));
let result = MessageStream::new(str.as_bytes()).parse_address();
let expected: HeaderValue = serde_yaml::from_str(input.1).unwrap_or(HeaderValue::Empty);
/*if input.0.len() >= 70 {
+416 -424
View File
@@ -12,8 +12,8 @@
use std::borrow::Cow;
use crate::{
decoders::{charsets::map::get_charset_decoder, encoded_word::decode_rfc2047, hex::decode_hex},
parsers::message::MessageStream,
decoders::{charsets::map::charset_decoder, hex::decode_hex},
parsers::MessageStream,
ContentType, HeaderValue,
};
@@ -55,476 +55,470 @@ struct ContentTypeParser<'x> {
is_token_start: bool,
}
#[inline(always)]
fn reset_parser(parser: &mut ContentTypeParser) {
parser.token_start = 0;
parser.is_token_start = true;
}
fn add_attribute<'x>(parser: &mut ContentTypeParser<'x>, stream: &MessageStream<'x>) -> bool {
if parser.token_start > 0 {
let mut attr = Some(String::from_utf8_lossy(
&stream.data[parser.token_start - 1..parser.token_end],
));
if !parser.is_lower_case {
attr.as_mut().unwrap().to_mut().make_ascii_lowercase();
parser.is_lower_case = true;
}
match parser.state {
ContentState::AttributeName => parser.attr_name = attr,
ContentState::Type => parser.c_type = attr,
ContentState::SubType => parser.c_subtype = attr,
_ => unreachable!(),
}
reset_parser(parser);
true
} else {
false
impl<'x> ContentTypeParser<'x> {
#[inline(always)]
fn reset_parser(&mut self) {
self.token_start = 0;
self.is_token_start = true;
}
}
fn add_attribute_parameter<'x>(parser: &mut ContentTypeParser<'x>, stream: &MessageStream<'x>) {
if parser.token_start > 0 {
let attr_part =
String::from_utf8_lossy(&stream.data[parser.token_start - 1..parser.token_end]);
fn add_attribute(&mut self, stream: &MessageStream<'x>) -> bool {
if self.token_start > 0 {
let mut attr = Some(String::from_utf8_lossy(
&stream.data[self.token_start - 1..self.token_end],
));
if parser.attr_charset.is_none() {
parser.attr_charset = attr_part.into();
} else {
let attr_name = parser
.attr_name
.as_ref()
.unwrap_or(&"unknown".into())
.clone()
+ "-language";
if !parser.attributes.iter().any(|(name, _)| name == &attr_name) {
parser.attributes.push((attr_name, attr_part));
} else {
parser.values.push("'".into());
parser.values.push(attr_part);
if !self.is_lower_case {
attr.as_mut().unwrap().to_mut().make_ascii_lowercase();
self.is_lower_case = true;
}
}
reset_parser(parser);
}
}
fn add_partial_value<'x>(
parser: &mut ContentTypeParser<'x>,
stream: &MessageStream<'x>,
to_cur_pos: bool,
) {
if parser.token_start > 0 {
let in_quote = parser.state == ContentState::AttributeQuotedValue;
parser.values.push(String::from_utf8_lossy(
&stream.data[parser.token_start - 1..if in_quote && to_cur_pos {
stream.pos - 1
} else {
parser.token_end
}],
));
if !in_quote {
parser.values.push(" ".into());
}
reset_parser(parser);
}
}
fn add_value<'x>(parser: &mut ContentTypeParser<'x>, stream: &MessageStream<'x>) {
if parser.attr_name.is_none() {
return;
}
let has_values = !parser.values.is_empty();
let value = if parser.token_start > 0 {
let value = &stream.data[parser.token_start - 1..parser.token_end];
Some(if !parser.remove_crlf {
String::from_utf8_lossy(value)
} else {
parser.remove_crlf = false;
match String::from_utf8(
value
.iter()
.filter(|&&ch| ch != b'\r' && ch != b'\n')
.copied()
.collect::<Vec<_>>(),
) {
Ok(value) => value.into(),
Err(err) => String::from_utf8_lossy(err.as_bytes()).into_owned().into(),
match self.state {
ContentState::AttributeName => self.attr_name = attr,
ContentState::Type => self.c_type = attr,
ContentState::SubType => self.c_subtype = attr,
_ => unreachable!(),
}
})
} else {
if !has_values {
self.reset_parser();
true
} else {
false
}
}
fn add_attribute_parameter(&mut self, stream: &MessageStream<'x>) {
if self.token_start > 0 {
let attr_part =
String::from_utf8_lossy(&stream.data[self.token_start - 1..self.token_end]);
if self.attr_charset.is_none() {
self.attr_charset = attr_part.into();
} else {
let attr_name =
self.attr_name.as_ref().unwrap_or(&"unknown".into()).clone() + "-language";
if !self.attributes.iter().any(|(name, _)| name == &attr_name) {
self.attributes.push((attr_name, attr_part));
} else {
self.values.push("'".into());
self.values.push(attr_part);
}
}
self.reset_parser();
}
}
fn add_partial_value(&mut self, stream: &MessageStream<'x>, to_cur_pos: bool) {
if self.token_start > 0 {
let in_quote = self.state == ContentState::AttributeQuotedValue;
self.values.push(String::from_utf8_lossy(
&stream.data[self.token_start - 1..if in_quote && to_cur_pos {
stream.offset() - 1
} else {
self.token_end
}],
));
if !in_quote {
self.values.push(" ".into());
}
self.reset_parser();
}
}
fn add_value(&mut self, stream: &MessageStream<'x>) {
if self.attr_name.is_none() {
return;
}
None
};
if !parser.is_continuation {
parser.attributes.push((
parser.attr_name.take().unwrap(),
if !has_values {
value.unwrap()
let has_values = !self.values.is_empty();
let value = if self.token_start > 0 {
let value = &stream.data[self.token_start - 1..self.token_end];
Some(if !self.remove_crlf {
String::from_utf8_lossy(value)
} else {
if let Some(value) = value {
parser.values.push(value);
self.remove_crlf = false;
match String::from_utf8(
value
.iter()
.filter(|&&ch| ch != b'\r' && ch != b'\n')
.copied()
.collect::<Vec<_>>(),
) {
Ok(value) => value.into(),
Err(err) => String::from_utf8_lossy(err.as_bytes()).into_owned().into(),
}
parser.values.concat().into()
},
));
} else {
let attr_name = parser.attr_name.take().unwrap();
let mut value = if let Some(value) = value {
if has_values {
Cow::from(parser.values.concat()) + value
} else {
value
}
})
} else {
parser.values.concat().into()
if !has_values {
return;
}
None
};
if parser.is_encoded_attribute {
if let (true, decoded_bytes) = decode_hex(value.as_bytes()) {
value = if let Some(decoder) = parser
.attr_charset
.as_ref()
.and_then(|c| get_charset_decoder(c.as_bytes()))
{
decoder(&decoded_bytes).into()
if !self.is_continuation {
self.attributes.push((
self.attr_name.take().unwrap(),
if !has_values {
value.unwrap()
} else {
String::from_utf8(decoded_bytes)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into()
if let Some(value) = value {
self.values.push(value);
}
self.values.concat().into()
},
));
} else {
let attr_name = self.attr_name.take().unwrap();
let mut value = if let Some(value) = value {
if has_values {
Cow::from(self.values.concat()) + value
} else {
value
}
}
parser.is_encoded_attribute = false;
}
if parser.attr_position > 0 {
let continuation = (attr_name, parser.attr_position, value);
if let Some(continuations) = parser.continuations.as_mut() {
continuations.push(continuation);
} else {
parser.continuations = Some(vec![continuation]);
}
self.values.concat().into()
};
parser.attr_position = 0;
} else {
parser.attributes.push((attr_name, value));
}
parser.is_continuation = false;
parser.attr_charset = None;
}
if has_values {
parser.values.clear();
}
reset_parser(parser);
}
fn add_attr_position(parser: &mut ContentTypeParser, stream: &MessageStream) -> bool {
if parser.token_start > 0 {
parser.attr_position =
String::from_utf8_lossy(&stream.data[parser.token_start - 1..parser.token_end])
.parse()
.unwrap_or(0);
reset_parser(parser);
true
} else {
false
}
}
fn merge_continuations(parser: &mut ContentTypeParser) {
let continuations = parser.continuations.as_mut().unwrap();
continuations.sort();
for (key, _, value) in continuations.drain(..) {
if let Some((_, old_value)) = parser.attributes.iter_mut().find(|(name, _)| name == &key) {
*old_value = format!("{}{}", old_value.to_owned(), value).into();
} else {
parser.attributes.push((key, value));
}
}
}
pub fn parse_content_type<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut parser = ContentTypeParser {
state: ContentState::Type,
state_stack: Vec::new(),
c_type: None,
c_subtype: None,
attr_name: None,
attr_charset: None,
attr_position: 0,
attributes: Vec::new(),
values: Vec::new(),
continuations: None,
is_continuation: false,
is_encoded_attribute: false,
is_lower_case: true,
is_token_start: true,
is_escaped: false,
remove_crlf: false,
token_start: 0,
token_end: 0,
};
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
if let ContentState::AttributeQuotedValue = parser.state {
if parser.token_start == 0 {
parser.token_start = stream.pos;
parser.token_end = parser.token_start;
} else {
parser.token_end = stream.pos;
}
}
continue;
}
b'A'..=b'Z' => {
if parser.is_lower_case {
if let ContentState::Type
| ContentState::SubType
| ContentState::AttributeName = parser.state
if self.is_encoded_attribute {
if let (true, decoded_bytes) = decode_hex(value.as_bytes()) {
value = if let Some(decoder) = self
.attr_charset
.as_ref()
.and_then(|c| charset_decoder(c.as_bytes()))
{
parser.is_lower_case = false;
decoder(&decoded_bytes).into()
} else {
String::from_utf8(decoded_bytes)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into()
}
}
self.is_encoded_attribute = false;
}
b'\n' => {
let next_is_space = matches!(stream.data.get(stream.pos), Some(b' ' | b'\t'));
match parser.state {
ContentState::Type | ContentState::AttributeName | ContentState::SubType => {
add_attribute(&mut parser, stream);
}
ContentState::AttributeValue => {
add_value(&mut parser, stream);
}
ContentState::AttributeQuotedValue => {
if next_is_space {
parser.remove_crlf = true;
continue;
} else {
add_value(&mut parser, stream);
}
}
_ => (),
}
if next_is_space {
parser.state = ContentState::AttributeName;
stream.pos += 1;
iter.next();
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
if self.attr_position > 0 {
let continuation = (attr_name, self.attr_position, value);
if let Some(continuations) = self.continuations.as_mut() {
continuations.push(continuation);
} else {
if parser.continuations.is_some() {
merge_continuations(&mut parser);
}
self.continuations = Some(vec![continuation]);
}
return if let Some(content_type) = parser.c_type {
HeaderValue::ContentType(ContentType {
c_type: content_type,
c_subtype: parser.c_subtype.take(),
attributes: if !parser.attributes.is_empty() {
Some(parser.attributes)
} else {
None
},
})
} else {
HeaderValue::Empty
};
}
self.attr_position = 0;
} else {
self.attributes.push((attr_name, value));
}
b'/' if parser.state == ContentState::Type => {
add_attribute(&mut parser, stream);
parser.state = ContentState::SubType;
continue;
}
b';' => match parser.state {
ContentState::Type | ContentState::SubType | ContentState::AttributeName => {
add_attribute(&mut parser, stream);
parser.state = ContentState::AttributeName;
continue;
}
ContentState::AttributeValue => {
if !parser.is_escaped {
add_value(&mut parser, stream);
parser.state = ContentState::AttributeName;
} else {
parser.is_escaped = false;
}
continue;
}
_ => (),
},
b'*' if parser.state == ContentState::AttributeName => {
if !parser.is_continuation {
parser.is_continuation = add_attribute(&mut parser, stream);
} else if !parser.is_encoded_attribute {
add_attr_position(&mut parser, stream);
parser.is_encoded_attribute = true;
} else {
// Malformed data, reset parser.
reset_parser(&mut parser);
}
continue;
}
b'=' => match parser.state {
ContentState::AttributeName => {
if !parser.is_continuation {
if !add_attribute(&mut parser, stream) {
continue;
}
} else if !parser.is_encoded_attribute {
/* If is_continuation=true && is_encoded_attribute=false,
the last character was a '*' which means encoding */
parser.is_encoded_attribute = !add_attr_position(&mut parser, stream);
} else {
reset_parser(&mut parser);
}
parser.state = ContentState::AttributeValue;
continue;
}
ContentState::AttributeValue | ContentState::AttributeQuotedValue
if parser.is_token_start =>
{
if let (d_bytes_read, Some(token)) = decode_rfc2047(stream, stream.pos) {
add_partial_value(&mut parser, stream, false);
parser.values.push(token.into());
stream.pos += d_bytes_read;
iter = stream.data[stream.pos..].iter();
continue;
}
}
_ => (),
},
b'\"' => match parser.state {
ContentState::AttributeValue => {
if !parser.is_token_start {
parser.is_token_start = true;
}
parser.state = ContentState::AttributeQuotedValue;
continue;
}
ContentState::AttributeQuotedValue => {
if !parser.is_escaped {
add_value(&mut parser, stream);
parser.state = ContentState::AttributeName;
continue;
} else {
parser.is_escaped = false;
}
}
_ => continue,
},
b'\\' => match parser.state {
ContentState::AttributeQuotedValue | ContentState::AttributeValue => {
if !parser.is_escaped {
add_partial_value(&mut parser, stream, true);
parser.is_escaped = true;
continue;
} else {
parser.is_escaped = false;
}
}
ContentState::Comment => parser.is_escaped = !parser.is_escaped,
_ => continue,
},
b'\''
if parser.is_encoded_attribute
&& !parser.is_escaped
&& (parser.state == ContentState::AttributeValue
|| parser.state == ContentState::AttributeQuotedValue) =>
self.is_continuation = false;
self.attr_charset = None;
}
if has_values {
self.values.clear();
}
self.reset_parser();
}
fn add_attr_position(&mut self, stream: &MessageStream) -> bool {
if self.token_start > 0 {
self.attr_position =
String::from_utf8_lossy(&stream.data[self.token_start - 1..self.token_end])
.parse()
.unwrap_or(0);
self.reset_parser();
true
} else {
false
}
}
fn merge_continuations(&mut self) {
let continuations = self.continuations.as_mut().unwrap();
continuations.sort();
for (key, _, value) in continuations.drain(..) {
if let Some((_, old_value)) = self.attributes.iter_mut().find(|(name, _)| name == &key)
{
add_attribute_parameter(&mut parser, stream);
continue;
*old_value = format!("{old_value}{value}").into();
} else {
self.attributes.push((key, value));
}
b'(' if parser.state != ContentState::AttributeQuotedValue => {
if !parser.is_escaped {
}
}
}
impl<'x> MessageStream<'x> {
pub fn parse_content_type(&mut self) -> HeaderValue<'x> {
let mut parser = ContentTypeParser {
state: ContentState::Type,
state_stack: Vec::new(),
c_type: None,
c_subtype: None,
attr_name: None,
attr_charset: None,
attr_position: 0,
attributes: Vec::new(),
values: Vec::new(),
continuations: None,
is_continuation: false,
is_encoded_attribute: false,
is_lower_case: true,
is_token_start: true,
is_escaped: false,
remove_crlf: false,
token_start: 0,
token_end: 0,
};
while let Some(ch) = self.next() {
match ch {
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
if let ContentState::AttributeQuotedValue = parser.state {
if parser.token_start == 0 {
parser.token_start = self.offset();
parser.token_end = parser.token_start;
} else {
parser.token_end = self.offset();
}
}
continue;
}
b'A'..=b'Z' => {
if parser.is_lower_case {
if let ContentState::Type
| ContentState::SubType
| ContentState::AttributeName = parser.state
{
parser.is_lower_case = false;
}
}
}
b'\n' => {
let next_is_space = self.peek_next_is_space();
match parser.state {
ContentState::Type
| ContentState::AttributeName
| ContentState::SubType => {
add_attribute(&mut parser, stream);
parser.add_attribute(self);
}
ContentState::AttributeValue => {
add_value(&mut parser, stream);
parser.add_value(self);
}
ContentState::AttributeQuotedValue => {
if next_is_space {
parser.remove_crlf = true;
continue;
} else {
parser.add_value(self);
}
}
_ => (),
}
parser.state_stack.push(parser.state);
parser.state = ContentState::Comment;
} else {
parser.is_escaped = false;
if next_is_space {
parser.state = ContentState::AttributeName;
self.next();
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
} else {
if parser.continuations.is_some() {
parser.merge_continuations();
}
return if let Some(content_type) = parser.c_type {
HeaderValue::ContentType(ContentType {
c_type: content_type,
c_subtype: parser.c_subtype.take(),
attributes: if !parser.attributes.is_empty() {
Some(parser.attributes)
} else {
None
},
})
} else {
HeaderValue::Empty
};
}
}
continue;
}
b')' if parser.state == ContentState::Comment => {
if !parser.is_escaped {
parser.state = parser.state_stack.pop().unwrap();
reset_parser(&mut parser);
} else {
parser.is_escaped = false;
b'/' if parser.state == ContentState::Type => {
parser.add_attribute(self);
parser.state = ContentState::SubType;
continue;
}
continue;
b';' => match parser.state {
ContentState::Type | ContentState::SubType | ContentState::AttributeName => {
parser.add_attribute(self);
parser.state = ContentState::AttributeName;
continue;
}
ContentState::AttributeValue => {
if !parser.is_escaped {
parser.add_value(self);
parser.state = ContentState::AttributeName;
} else {
parser.is_escaped = false;
}
continue;
}
_ => (),
},
b'*' if parser.state == ContentState::AttributeName => {
if !parser.is_continuation {
parser.is_continuation = parser.add_attribute(self);
} else if !parser.is_encoded_attribute {
parser.add_attr_position(self);
parser.is_encoded_attribute = true;
} else {
// Malformed data, reset parser.
parser.reset_parser();
}
continue;
}
b'=' => match parser.state {
ContentState::AttributeName => {
if !parser.is_continuation {
if !parser.add_attribute(self) {
continue;
}
} else if !parser.is_encoded_attribute {
/* If is_continuation=true && is_encoded_attribute=false,
the last character was a '*' which means encoding */
parser.is_encoded_attribute = !parser.add_attr_position(self);
} else {
parser.reset_parser();
}
parser.state = ContentState::AttributeValue;
continue;
}
ContentState::AttributeValue | ContentState::AttributeQuotedValue
if parser.is_token_start && self.peek_char(b'?') =>
{
self.checkpoint();
if let Some(token) = self.decode_rfc2047() {
parser.add_partial_value(self, false);
parser.values.push(token.into());
continue;
}
self.restore();
}
_ => (),
},
b'\"' => match parser.state {
ContentState::AttributeValue => {
if !parser.is_token_start {
parser.is_token_start = true;
}
parser.state = ContentState::AttributeQuotedValue;
continue;
}
ContentState::AttributeQuotedValue => {
if !parser.is_escaped {
parser.add_value(self);
parser.state = ContentState::AttributeName;
continue;
} else {
parser.is_escaped = false;
}
}
_ => continue,
},
b'\\' => match parser.state {
ContentState::AttributeQuotedValue | ContentState::AttributeValue => {
if !parser.is_escaped {
parser.add_partial_value(self, true);
parser.is_escaped = true;
continue;
} else {
parser.is_escaped = false;
}
}
ContentState::Comment => parser.is_escaped = !parser.is_escaped,
_ => continue,
},
b'\''
if parser.is_encoded_attribute
&& !parser.is_escaped
&& (parser.state == ContentState::AttributeValue
|| parser.state == ContentState::AttributeQuotedValue) =>
{
parser.add_attribute_parameter(self);
continue;
}
b'(' if parser.state != ContentState::AttributeQuotedValue => {
if !parser.is_escaped {
match parser.state {
ContentState::Type
| ContentState::AttributeName
| ContentState::SubType => {
parser.add_attribute(self);
}
ContentState::AttributeValue => {
parser.add_value(self);
}
_ => (),
}
parser.state_stack.push(parser.state);
parser.state = ContentState::Comment;
} else {
parser.is_escaped = false;
}
continue;
}
b')' if parser.state == ContentState::Comment => {
if !parser.is_escaped {
parser.state = parser.state_stack.pop().unwrap();
parser.reset_parser();
} else {
parser.is_escaped = false;
}
continue;
}
b'\r' => continue,
_ => (),
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = self.offset();
parser.token_end = parser.token_start;
} else {
parser.token_end = self.offset();
}
b'\r' => continue,
_ => (),
}
if parser.is_escaped {
parser.is_escaped = false;
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = stream.pos;
parser.token_end = parser.token_start;
} else {
parser.token_end = stream.pos;
}
HeaderValue::Empty
}
HeaderValue::Empty
}
#[cfg(test)]
mod tests {
use std::{borrow::Cow, collections::HashMap};
use serde::{Deserialize, Serialize};
use crate::{parsers::message::MessageStream, HeaderValue};
use crate::{parsers::MessageStream, HeaderValue};
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub struct ContentTypeMap<'x> {
@@ -541,8 +535,6 @@ mod tests {
#[test]
fn parse_content_fields() {
use super::parse_content_type;
let inputs =
[
(
@@ -1571,7 +1563,7 @@ mod tests {
let str = input.0.to_string();
// TODO: Redo tests without using hashmaps.
let result = match parse_content_type(&mut MessageStream::new(str.as_bytes())) {
let result = match MessageStream::new(str.as_bytes()).parse_content_type() {
HeaderValue::ContentType(ct) => HeaderValueMap::ContentType(ContentTypeMap {
c_type: ct.c_type,
c_subtype: ct.c_subtype,
+352 -144
View File
@@ -11,20 +11,139 @@
use std::fmt;
use crate::{parsers::message::MessageStream, DateTime, HeaderValue};
use crate::{parsers::MessageStream, DateTime, HeaderValue};
pub static DOW: &[&str] = &["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
pub static MONTH: &[&str] = &[
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
];
impl DateTime {
/// Parses an RFC822 date
pub fn parse_rfc822(&self, value: &str) -> Option<Self> {
match parse_date(&mut MessageStream {
data: value.as_bytes(),
pos: 0,
}) {
pub fn parse_rfc822(value: &str) -> Option<Self> {
match MessageStream::new(value.as_bytes()).parse_date() {
HeaderValue::DateTime(dt) => dt.into(),
_ => None,
}
}
/// Parses an RFC3339 date
pub fn parse_rfc3339(value: &str) -> Option<Self> {
// 2004 - 06 - 28 T 23 : 43 : 45 . 000 Z
// 1969 - 02 - 13 T 23 : 32 : 00 - 03 : 30
// 0 1 2 3 4 5 6 7
let mut pos = 0;
let mut parts = [0u32; 8];
let mut parts_sizes = [
4u32, // Year (0)
2u32, // Month (1)
2u32, // Day (2)
2u32, // Hour (3)
2u32, // Minute (4)
2u32, // Second (5)
2u32, // TZ Hour (6)
2u32, // TZ Minute (7)
];
let mut skip_digits = false;
let mut is_plus = true;
for ch in value.as_bytes() {
match ch {
b'0'..=b'9' if !skip_digits => {
if parts_sizes[pos] > 0 {
parts_sizes[pos] -= 1;
parts[pos] += (*ch - b'0') as u32 * u32::pow(10, parts_sizes[pos]);
} else {
return None;
}
}
b'-' => {
if pos <= 1 {
pos += 1;
} else if pos == 5 {
pos += 1;
is_plus = false;
skip_digits = false;
} else {
return None;
}
}
b'T' => {
if pos == 2 {
pos += 1;
} else {
return None;
}
}
b':' => {
if [3, 4, 6].contains(&pos) {
pos += 1;
} else {
return None;
}
}
b'+' => {
if pos == 5 {
pos += 1;
skip_digits = false;
} else {
return None;
}
}
b'.' => {
if pos == 5 {
skip_digits = true;
} else {
return None;
}
}
_ => (),
}
}
if pos >= 5 {
DateTime {
year: parts[0] as u16,
month: parts[1] as u8,
day: parts[2] as u8,
hour: parts[3] as u8,
minute: parts[4] as u8,
second: parts[5] as u8,
tz_hour: parts[6] as u8,
tz_minute: parts[7] as u8,
tz_before_gmt: !is_plus,
}
.into()
} else {
None
}
}
/// Return an RFC822 date
pub fn to_rfc822(&self) -> String {
format!(
"{}, {} {} {:04} {:02}:{:02}:{:02} {}{:02}{:02}",
DOW[self.day_of_week() as usize],
self.day,
MONTH
.get(self.month.saturating_sub(1) as usize)
.unwrap_or(&""),
self.year,
self.hour,
self.minute,
self.second,
if self.tz_before_gmt && (self.tz_hour > 0 || self.tz_minute > 0) {
"-"
} else {
"+"
},
self.tz_hour,
self.tz_minute
)
}
/// Returns an RFC3339 representation of the parsed RFC5322 datetime field
pub fn to_rfc3339(&self) -> String {
if self.tz_hour != 0 || self.tz_minute != 0 {
@@ -55,7 +174,7 @@ impl DateTime {
/// Returns true if the date is valid
pub fn is_valid(&self) -> bool {
(0..=23).contains(&self.tz_hour)
&& (1970..=3000).contains(&self.year)
&& (1900..=3000).contains(&self.year)
&& (0..=59).contains(&self.tz_minute)
&& (1..=12).contains(&self.month)
&& (1..=31).contains(&self.day)
@@ -67,11 +186,19 @@ impl DateTime {
/// Returns the numbers of seconds since 1970-01-01T00:00:00Z (Unix epoch)
/// or None if the date is invalid.
pub fn to_timestamp(&self) -> i64 {
self.to_timestamp_local()
+ ((self.tz_hour as i64 * 3600 + self.tz_minute as i64 * 60)
* if self.tz_before_gmt { 1 } else { -1 })
}
/// Returns the numbers of seconds since 1970-01-01T00:00:00Z (Unix epoch) in local time
/// or None if the date is invalid.
pub fn to_timestamp_local(&self) -> i64 {
// Ported from https://github.com/protocolbuffers/upb/blob/22182e6e/upb/json_decode.c#L982-L992
let month = self.month as u32;
let year_base = 4800; /* Before min year, multiple of 400. */
let m_adj = month.wrapping_sub(3); /* March-based month. */
let carry = if m_adj > month { 1 } else { 0 };
let carry = i64::from(m_adj > month);
let adjust = if carry > 0 { 12 } else { 0 };
let y_adj = self.year as i64 + year_base - carry;
let month_days = ((m_adj.wrapping_add(adjust)) * 62719 + 769) / 2048;
@@ -80,8 +207,61 @@ impl DateTime {
+ self.hour as i64 * 3600
+ self.minute as i64 * 60
+ self.second as i64
+ ((self.tz_hour as i64 * 3600 + self.tz_minute as i64 * 60)
* if self.tz_before_gmt { 1 } else { -1 })
}
/// Creates a DateTime object from a timestamp
pub fn from_timestamp(timestamp: i64) -> Self {
// Ported from http://howardhinnant.github.io/date_algorithms.html#civil_from_days
let (z, seconds) = ((timestamp / 86400) + 719468, timestamp % 86400);
let era: i64 = (if z >= 0 { z } else { z - 146096 }) / 146097;
let doe: u64 = (z - era * 146097) as u64; // [0, 146096]
let yoe: u64 = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; // [0, 399]
let y: i64 = (yoe as i64) + era * 400;
let doy: u64 = doe - (365 * yoe + yoe / 4 - yoe / 100); // [0, 365]
let mp = (5 * doy + 2) / 153; // [0, 11]
let d: u64 = doy - (153 * mp + 2) / 5 + 1; // [1, 31]
let m: u64 = if mp < 10 { mp + 3 } else { mp - 9 }; // [1, 12]
let (h, mn, s) = (seconds / 3600, (seconds / 60) % 60, seconds % 60);
DateTime {
year: (y + i64::from(m <= 2)) as u16,
month: m as u8,
day: d as u8,
hour: h as u8,
minute: mn as u8,
second: s as u8,
tz_before_gmt: false,
tz_hour: 0,
tz_minute: 0,
}
}
/// Returns the day of week where [0, 6] represents [Sun, Sat].
pub fn day_of_week(&self) -> u8 {
(((self.to_timestamp_local() as f64 / 86400.0).floor() as i64 + 4).rem_euclid(7)) as u8
}
/// Returns the julian day
pub fn julian_day(&self) -> i64 {
let day = self.day as i64;
let (month, year) = if self.month > 2 {
((self.month - 3) as i64, self.year as i64)
} else {
((self.month + 9) as i64, (self.year - 1) as i64)
};
let c = year / 100;
c * 146097 / 4 + (year - c * 100) * 1461 / 4 + (month * 153 + 2) / 5 + day + 1721119
}
/// Converts the DateTime to the given timezone
pub fn to_timezone(&self, tz: i64) -> DateTime {
let mut dt = DateTime::from_timestamp(self.to_timestamp() + tz);
dt.tz_before_gmt = tz < 0;
let tz = tz.abs();
dt.tz_hour = (tz / 3600) as u8;
dt.tz_minute = (tz % 3600) as u8;
dt
}
}
@@ -107,142 +287,158 @@ impl fmt::Display for DateTime {
}
}
pub fn parse_date<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut pos = 0;
let mut parts = [0u32; 7];
let mut parts_sizes = [
2u32, // Day (0)
2u32, // Month (1)
4u32, // Year (2)
2u32, // Hour (3)
2u32, // Minute (4)
2u32, // Second (5)
4u32, // TZ (6)
];
let mut month_hash: usize = 0;
let mut month_pos: usize = 0;
impl<'x> MessageStream<'x> {
pub fn parse_date(&mut self) -> HeaderValue<'x> {
let mut pos = 0;
let mut parts = [0u32; 7];
let mut parts_sizes = [
2u32, // Day (0)
2u32, // Month (1)
4u32, // Year (2)
2u32, // Hour (3)
2u32, // Minute (4)
2u32, // Second (5)
4u32, // TZ (6)
];
let mut month_hash: usize = 0;
let mut month_pos: usize = 0;
let mut is_plus = true;
let mut is_new_token = true;
let mut ignore = true;
let mut comment_count = 0;
let mut is_plus = true;
let mut is_new_token = true;
let mut ignore = true;
let mut comment_count = 0;
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = self.next() {
let mut next_part = false;
while let Some(ch) = iter.next() {
let mut next_part = false;
stream.pos += 1;
match ch {
b'\n' => match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
iter.next();
stream.pos += 1;
if !is_new_token && !ignore && comment_count == 0 {
next_part = true;
match ch {
b'\n' => {
if self.try_next_is_space() {
if !is_new_token && !ignore && comment_count == 0 {
next_part = true;
} else {
continue;
}
} else {
continue;
break;
}
}
_ => break,
},
_ if comment_count > 0 => {
if *ch == b')' {
comment_count -= 1;
} else if *ch == b'(' {
_ if comment_count > 0 => {
if *ch == b')' {
comment_count -= 1;
} else if *ch == b'(' {
comment_count += 1;
} else if *ch == b'\\' {
self.try_skip_char(b')');
}
continue;
}
b'0'..=b'9' => {
if pos < 7 && parts_sizes[pos] > 0 {
parts_sizes[pos] -= 1;
parts[pos] += (*ch - b'0') as u32 * u32::pow(10, parts_sizes[pos]);
if ignore {
ignore = false;
}
}
if is_new_token {
is_new_token = false;
}
}
b':' => {
if !is_new_token && !ignore && (pos == 3 || pos == 4) {
next_part = true;
}
}
b'+' => {
pos = 6;
}
b'-' => {
is_plus = false;
pos = 6;
}
b' ' | b'\t' => {
if !is_new_token && !ignore {
next_part = true;
}
}
b'a'..=b'z' | b'A'..=b'Z' => {
if pos == 1 {
if (1..=2).contains(&month_pos) {
month_hash += MONTH_HASH
[(if *ch <= b'Z' { *ch + 32 } else { *ch }) as usize]
as usize;
}
month_pos += 1;
}
if is_new_token {
is_new_token = false;
}
}
b'(' => {
comment_count += 1;
} else if *ch == b'\\' {
if let Some(b')') = stream.data.get(stream.pos) {
stream.pos += 1;
}
is_new_token = true;
continue;
}
continue;
b',' | b'\r' => (),
b';' => {
// May be parsing Received field, reset state.
pos = 0;
parts = [0u32; 7];
parts_sizes = [
2u32, // Day (0)
2u32, // Month (1)
4u32, // Year (2)
2u32, // Hour (3)
2u32, // Minute (4)
2u32, // Second (5)
4u32, // TZ (6)
];
month_hash = 0;
month_pos = 0;
is_plus = true;
is_new_token = true;
ignore = true;
continue;
}
_ => (),
}
b'0'..=b'9' => {
if next_part {
if pos < 7 && parts_sizes[pos] > 0 {
parts_sizes[pos] -= 1;
parts[pos] += (*ch - b'0') as u32 * u32::pow(10, parts_sizes[pos]);
if ignore {
ignore = false;
}
parts[pos] /= u32::pow(10, parts_sizes[pos]);
}
if is_new_token {
is_new_token = false;
}
}
b':' => {
if !is_new_token && !ignore && (pos == 3 || pos == 4) {
next_part = true;
}
}
b'+' => {
pos = 6;
}
b'-' => {
is_plus = false;
pos = 6;
}
b' ' | b'\t' => {
if !is_new_token && !ignore {
next_part = true;
}
}
b'a'..=b'z' | b'A'..=b'Z' => {
if pos == 1 {
if (1..=2).contains(&month_pos) {
month_hash += MONTH_HASH
[(if *ch <= b'Z' { *ch + 32 } else { *ch }) as usize]
as usize;
}
month_pos += 1;
}
if is_new_token {
is_new_token = false;
}
}
b'(' => {
comment_count += 1;
pos += 1;
is_new_token = true;
continue;
}
b',' | b'\r' => (),
_ => (),
}
if next_part {
if pos < 7 && parts_sizes[pos] > 0 {
parts[pos] /= u32::pow(10, parts_sizes[pos]);
}
pos += 1;
is_new_token = true;
if pos >= 6 {
HeaderValue::DateTime(DateTime {
year: if (1..=99).contains(&parts[2]) {
parts[2] + 1900
} else {
parts[2]
} as u16,
month: if month_pos == 3 && month_hash <= 30 {
MONTH_MAP[month_hash]
} else {
parts[1] as u8
},
day: parts[0] as u8,
hour: parts[3] as u8,
minute: parts[4] as u8,
second: parts[5] as u8,
tz_hour: (parts[6] / 100) as u8,
tz_minute: (parts[6] % 100) as u8,
tz_before_gmt: !is_plus,
})
} else {
HeaderValue::Empty
}
}
if pos >= 6 {
HeaderValue::DateTime(DateTime {
year: if (1..=99).contains(&parts[2]) {
parts[2] + 1900
} else {
parts[2]
} as u16,
month: if month_pos == 3 && month_hash <= 30 {
MONTH_MAP[month_hash] as u8
} else {
parts[1] as u8
},
day: parts[0] as u8,
hour: parts[3] as u8,
minute: parts[4] as u8,
second: parts[5] as u8,
tz_hour: (parts[6] / 100) as u8,
tz_minute: (parts[6] % 100) as u8,
tz_before_gmt: !is_plus,
})
} else {
HeaderValue::Empty
}
}
static MONTH_HASH: &[u8] = &[
@@ -267,37 +463,38 @@ pub static MONTH_MAP: &[u8; 31] = &[
mod tests {
use chrono::{FixedOffset, LocalResult, SecondsFormat, TimeZone, Utc};
use crate::{
parsers::{fields::date::parse_date, message::MessageStream},
HeaderValue,
};
use crate::{parsers::MessageStream, HeaderValue};
#[test]
fn parse_dates() {
let inputs = [
(
"Fri, 21 Nov 1997 09:55:06 -0600",
"1997-11-21T09:55:06-06:00",
"Tue, 1 Jul 2003 10:52:37 +0200",
"2003-07-01T10:52:37+02:00",
),
(
"Tue, 1 Jul 2003 10:52:37 +0200",
"2003-07-01T10:52:37+02:00",
),
(
"Thu, 13 Feb 1969 23:32:54 -0330",
"1969-02-13T23:32:54-03:30",
"Fri, 21 Nov 1997 09:55:06 -0600",
"1997-11-21T09:55:06-06:00",
),
(
"Mon, 24 Nov 1997 14:22:01 -0800",
"1997-11-24T14:22:01-08:00",
),
(
"Thu,\n 13\n Feb\n 1969\n 23:32\n -0330 (Newfoundland Time)\n",
"1969-02-13T23:32:00-03:30",
"Tue, 30 Dec 1969 23:32:54 -0330",
"1969-12-30T23:32:54-03:30",
),
(
"Tue, 1 Jul 2003 10:52:37 +0200",
"2003-07-01T10:52:37+02:00",
"Thu, 13 Feb 1969 23:32:54 -0330",
"1969-02-13T23:32:54-03:30",
),
(
"Thu,\n 13\n Feb\n 1969\n 23:32\n -0330 (Newfoundland Time)\n",
"1969-02-13T23:32:00-03:30",
),
(
" 1 Jul 2003 (comment about date) 10:52:37 +0200",
@@ -332,12 +529,23 @@ mod tests {
("11 nov 2021 09:55:06 +0200", "2021-11-11T09:55:06+02:00"),
("12 dec 2021 09:55:06 +0200", "2021-12-12T09:55:06+02:00"),
("13 zzz 2021 09:55:06 +0200", "2021-00-13T09:55:06+02:00"),
(
concat!(
"by 2002:aa7:cd10:0:b0:45c:2c83:1208 with SMTP id ",
"b16-20020aa7cd10000000b0045c2c831208mr4220805edw.81.1665423075119;\n\t",
"Mon, 10 Oct 2022 10:31:15 -0700 (PDT)"
),
"2022-10-10T10:31:15-07:00",
),
];
for (input, expected_result) in inputs {
match parse_date(&mut MessageStream::new(input.as_bytes())) {
for (pos, (input, expected_result)) in inputs.iter().enumerate() {
match MessageStream::new(input.as_bytes()).parse_date() {
HeaderValue::DateTime(datetime) => {
assert_eq!(expected_result, datetime.to_rfc3339());
if pos < 6 {
assert_eq!(*input, datetime.to_rfc822());
}
assert_eq!(*expected_result, datetime.to_rfc3339());
if datetime.is_valid() {
if let LocalResult::Single(chrono_datetime)
+57 -64
View File
@@ -9,82 +9,75 @@
* except according to those terms.
*/
use crate::{parsers::message::MessageStream, HeaderValue};
use crate::{parsers::MessageStream, HeaderValue};
pub fn parse_id<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
let mut token_invalid_start: usize = 0; // Handle broken clients
let mut token_invalid_end: usize = 0; // Handle broken clients
let mut is_id_part = false;
let mut ids = Vec::new();
impl<'x> MessageStream<'x> {
pub fn parse_id(&mut self) -> HeaderValue<'x> {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
let mut token_invalid_start: usize = 0; // Handle broken clients
let mut token_invalid_end: usize = 0; // Handle broken clients
let mut is_id_part = false;
let mut ids = Vec::new();
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b'\n' => match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
iter.next();
stream.pos += 1;
continue;
}
_ => {
return match ids.len() {
1 => HeaderValue::Text(ids.pop().unwrap()),
0 => {
if token_invalid_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
&stream.data[token_invalid_start - 1..token_invalid_end],
))
} else {
HeaderValue::Empty
while let Some(&ch) = self.next() {
match ch {
b'\n' => {
if !self.try_next_is_space() {
return match ids.len() {
1 => HeaderValue::Text(ids.pop().unwrap()),
0 => {
if token_invalid_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
self.bytes(token_invalid_start - 1..token_invalid_end),
))
} else {
HeaderValue::Empty
}
}
}
_ => HeaderValue::TextList(ids),
};
_ => HeaderValue::TextList(ids),
};
} else {
continue;
}
}
},
b'<' => {
is_id_part = true;
continue;
}
b'>' => {
is_id_part = false;
if token_start > 0 {
ids.push(String::from_utf8_lossy(
&stream.data[token_start - 1..token_end],
));
token_start = 0;
} else {
b'<' => {
is_id_part = true;
continue;
}
b'>' => {
is_id_part = false;
if token_start > 0 {
ids.push(String::from_utf8_lossy(
self.bytes(token_start - 1..token_end),
));
token_start = 0;
} else {
continue;
}
}
b' ' | b'\t' | b'\r' => continue,
_ => {}
}
b' ' | b'\t' | b'\r' => continue,
_ => {}
}
if is_id_part {
if token_start == 0 {
token_start = stream.pos;
if is_id_part {
if token_start == 0 {
token_start = self.offset();
}
token_end = self.offset();
} else {
if token_invalid_start == 0 {
token_invalid_start = self.offset();
}
token_invalid_end = self.offset();
}
token_end = stream.pos;
} else {
if token_invalid_start == 0 {
token_invalid_start = stream.pos;
}
token_invalid_end = stream.pos;
}
HeaderValue::Empty
}
HeaderValue::Empty
}
#[cfg(test)]
mod tests {
use crate::parsers::fields::id::parse_id;
use crate::parsers::message::MessageStream;
use crate::HeaderValue;
use crate::{parsers::MessageStream, HeaderValue};
#[test]
fn parse_message_ids() {
@@ -132,7 +125,7 @@ mod tests {
for input in inputs {
let str = input.0.to_string();
match parse_id(&mut MessageStream::new(str.as_bytes())) {
match MessageStream::new(str.as_bytes()).parse_id() {
HeaderValue::TextList(ids) => {
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
}
+77 -88
View File
@@ -11,7 +11,7 @@
use std::borrow::Cow;
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, HeaderValue};
use crate::{parsers::MessageStream, HeaderValue};
struct ListParser<'x> {
token_start: usize,
@@ -21,116 +21,105 @@ struct ListParser<'x> {
list: Vec<Cow<'x, str>>,
}
fn add_token<'x>(parser: &mut ListParser<'x>, stream: &MessageStream<'x>, add_space: bool) {
if parser.token_start > 0 {
if !parser.tokens.is_empty() {
parser.tokens.push(" ".into());
}
parser.tokens.push(String::from_utf8_lossy(
&stream.data[parser.token_start - 1..parser.token_end],
));
impl<'x> ListParser<'x> {
fn add_token(&mut self, stream: &MessageStream<'x>, add_space: bool) {
if self.token_start > 0 {
if !self.tokens.is_empty() {
self.tokens.push(" ".into());
}
self.tokens.push(String::from_utf8_lossy(
&stream.data[self.token_start - 1..self.token_end],
));
if add_space {
parser.tokens.push(" ".into());
}
if add_space {
self.tokens.push(" ".into());
}
parser.token_start = 0;
parser.is_token_start = true;
self.token_start = 0;
self.is_token_start = true;
}
}
fn add_tokens_to_list(&mut self) {
if !self.tokens.is_empty() {
self.list.push(if self.tokens.len() == 1 {
self.tokens.pop().unwrap()
} else {
let value = self.tokens.concat();
self.tokens.clear();
value.into()
});
}
}
}
fn add_tokens_to_list(parser: &mut ListParser) {
if !parser.tokens.is_empty() {
parser.list.push(if parser.tokens.len() == 1 {
parser.tokens.pop().unwrap()
} else {
let value = parser.tokens.concat();
parser.tokens.clear();
value.into()
});
}
}
impl<'x> MessageStream<'x> {
pub fn parse_comma_separared(&mut self) -> HeaderValue<'x> {
let mut parser = ListParser {
token_start: 0,
token_end: 0,
is_token_start: true,
tokens: Vec::new(),
list: Vec::new(),
};
pub fn parse_comma_separared<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut parser = ListParser {
token_start: 0,
token_end: 0,
is_token_start: true,
tokens: Vec::new(),
list: Vec::new(),
};
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b'\n' => {
add_token(&mut parser, stream, false);
match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
if !parser.is_token_start {
parser.is_token_start = true;
}
iter.next();
stream.pos += 1;
continue;
}
_ => {
add_tokens_to_list(&mut parser);
while let Some(ch) = self.next() {
match ch {
b'\n' => {
parser.add_token(self, false);
if !self.try_next_is_space() {
parser.add_tokens_to_list();
return match parser.list.len() {
1 => HeaderValue::Text(parser.list.pop().unwrap()),
0 => HeaderValue::Empty,
_ => HeaderValue::TextList(parser.list),
};
} else {
continue;
}
}
}
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
}
b'=' if parser.is_token_start => {
if let (bytes_read, Some(token)) = decode_rfc2047(stream, stream.pos) {
add_token(&mut parser, stream, true);
parser.tokens.push(token.into());
stream.pos += bytes_read;
iter = stream.data[stream.pos..].iter();
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
}
b'=' if parser.is_token_start && self.peek_char(b'?') => {
self.checkpoint();
if let Some(token) = self.decode_rfc2047() {
parser.add_token(self, true);
parser.tokens.push(token.into());
continue;
}
self.restore();
}
b',' => {
parser.add_token(self, false);
parser.add_tokens_to_list();
continue;
}
b'\r' => continue,
_ => (),
}
b',' => {
add_token(&mut parser, stream, false);
add_tokens_to_list(&mut parser);
continue;
if parser.is_token_start {
parser.is_token_start = false;
}
b'\r' => continue,
_ => (),
if parser.token_start == 0 {
parser.token_start = self.offset();
}
parser.token_end = self.offset();
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = stream.pos;
}
parser.token_end = stream.pos;
HeaderValue::Empty
}
HeaderValue::Empty
}
#[cfg(test)]
mod tests {
use crate::parsers::fields::list::parse_comma_separared;
use crate::parsers::message::MessageStream;
use crate::HeaderValue;
use crate::{parsers::MessageStream, HeaderValue};
#[test]
fn parse_comma_separated_text() {
@@ -174,7 +163,7 @@ mod tests {
for input in inputs {
let str = input.0.to_string();
match parse_comma_separared(&mut MessageStream::new(str.as_bytes())) {
match MessageStream::new(str.as_bytes()).parse_comma_separared() {
HeaderValue::TextList(ids) => {
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
}
+35 -52
View File
@@ -9,61 +9,46 @@
* except according to those terms.
*/
use crate::{parsers::message::MessageStream, HeaderValue};
use crate::{parsers::MessageStream, HeaderValue};
pub fn parse_raw<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
impl<'x> MessageStream<'x> {
pub fn parse_raw(&mut self) -> HeaderValue<'x> {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b'\n' => match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
iter.next();
stream.pos += 1;
continue;
}
_ => {
return if token_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
&stream.data[token_start - 1..token_end],
))
while let Some(ch) = self.next() {
match ch {
b'\n' => {
if !self.try_next_is_space() {
return if token_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
self.bytes(token_start - 1..token_end),
))
} else {
HeaderValue::Empty
};
} else {
HeaderValue::Empty
};
continue;
}
}
},
b' ' | b'\t' | b'\r' => continue,
_ => (),
b' ' | b'\t' | b'\r' => continue,
_ => (),
}
if token_start == 0 {
token_start = self.offset();
}
token_end = self.offset();
}
if token_start == 0 {
token_start = stream.pos;
}
token_end = stream.pos;
HeaderValue::Empty
}
HeaderValue::Empty
}
pub fn parse_and_ignore(stream: &mut MessageStream) {
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = iter.next() {
stream.pos += 1;
if ch == &b'\n' {
match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
iter.next();
stream.pos += 1;
continue;
}
_ => break,
pub fn parse_and_ignore(&mut self) {
while let Some(&ch) = self.next() {
if ch == b'\n' && !self.try_next_is_space() {
break;
}
}
}
@@ -71,9 +56,7 @@ pub fn parse_and_ignore(stream: &mut MessageStream) {
#[cfg(test)]
mod tests {
use crate::parsers::fields::raw::parse_raw;
use crate::parsers::message::MessageStream;
use crate::Message;
use crate::{parsers::MessageStream, Message};
#[test]
fn parse_raw_text() {
@@ -97,7 +80,7 @@ mod tests {
for input in inputs {
let str = input.0.to_string();
assert_eq!(
parse_raw(&mut MessageStream::new(str.as_bytes())).unwrap_text(),
MessageStream::new(str.as_bytes()).parse_raw().unwrap_text(),
input.1,
"Failed for '{:?}'",
input.0
@@ -116,7 +99,7 @@ Content-Type: multipart/mixed; boundary="festivus";
Here's a message body.
"#;
let message = Message::parse(input).unwrap();
let mut iter = message.get_headers_raw();
let mut iter = message.headers_raw();
assert_eq!(
iter.next().unwrap(),
("From", " Art Vandelay <art@vandelay.com>\n")
+2 -2
View File
@@ -275,7 +275,7 @@ mod tests {
];
for (input, expected) in tests {
assert_eq!(thread_name(input), expected, "{:?}", input);
assert_eq!(thread_name(input), expected, "{input:?}");
}
}
@@ -302,7 +302,7 @@ mod tests {
];
for (input, expected) in tests {
assert_eq!(trim_trailing_fwd(input), expected, "{:?}", input);
assert_eq!(trim_trailing_fwd(input), expected, "{input:?}");
}
}
}
+84 -75
View File
@@ -11,106 +11,87 @@
use std::borrow::Cow;
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, HeaderValue};
use crate::{parsers::MessageStream, HeaderValue};
struct UnstructuredParser<'x> {
token_start: usize,
token_end: usize,
is_token_start: bool,
tokens: Vec<Cow<'x, str>>,
}
fn add_token<'x>(parser: &mut UnstructuredParser<'x>, stream: &MessageStream<'x>, add_space: bool) {
if parser.token_start > 0 {
if !parser.tokens.is_empty() {
parser.tokens.push(" ".into());
}
parser.tokens.push(String::from_utf8_lossy(
&stream.data[parser.token_start - 1..parser.token_end],
));
impl<'x> UnstructuredParser<'x> {
fn add_token(&mut self, stream: &MessageStream<'x>, add_space: bool) {
if self.token_start > 0 {
if !self.tokens.is_empty() {
self.tokens.push(" ".into());
}
self.tokens.push(String::from_utf8_lossy(
stream.bytes(self.token_start - 1..self.token_end),
));
if add_space {
parser.tokens.push(" ".into());
}
if add_space {
self.tokens.push(" ".into());
}
parser.token_start = 0;
parser.is_token_start = true;
self.token_start = 0;
}
}
}
pub fn parse_unstructured<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
let mut parser = UnstructuredParser {
token_start: 0,
token_end: 0,
is_token_start: true,
tokens: Vec::new(),
};
impl<'x> MessageStream<'x> {
pub fn parse_unstructured(&mut self) -> HeaderValue<'x> {
let mut parser = UnstructuredParser {
token_start: 0,
token_end: 0,
tokens: Vec::new(),
};
let mut iter = stream.data[stream.pos..].iter();
while let Some(ch) = self.next() {
match ch {
b'\n' => {
parser.add_token(self, false);
while let Some(ch) = iter.next() {
stream.pos += 1;
match ch {
b'\n' => {
add_token(&mut parser, stream, false);
match stream.data.get(stream.pos) {
Some(b' ' | b'\t') => {
if !parser.is_token_start {
parser.is_token_start = true;
}
iter.next();
stream.pos += 1;
continue;
}
_ => {
if !self.try_next_is_space() {
return match parser.tokens.len() {
1 => HeaderValue::Text(parser.tokens.pop().unwrap()),
0 => HeaderValue::Empty,
_ => HeaderValue::Text(parser.tokens.concat().into()),
};
} else {
continue;
}
}
}
b' ' | b'\t' => {
if !parser.is_token_start {
parser.is_token_start = true;
}
continue;
}
b'=' if parser.is_token_start => {
if let (bytes_read, Some(token)) = decode_rfc2047(stream, stream.pos) {
add_token(&mut parser, stream, true);
parser.tokens.push(token.into());
stream.pos += bytes_read;
iter = stream.data[stream.pos..].iter();
b' ' | b'\t' | b'\r' => {
continue;
}
b'=' if self.peek_char(b'?') => {
self.checkpoint();
if let Some(token) = self.decode_rfc2047() {
parser.add_token(self, true);
parser.tokens.push(token.into());
continue;
}
self.restore();
}
_ => (),
}
b'\r' => continue,
_ => (),
if parser.token_start == 0 {
parser.token_start = self.offset();
}
parser.token_end = self.offset();
}
if parser.is_token_start {
parser.is_token_start = false;
}
if parser.token_start == 0 {
parser.token_start = stream.pos;
}
parser.token_end = stream.pos;
HeaderValue::Empty
}
HeaderValue::Empty
}
#[cfg(test)]
mod tests {
#[test]
fn parse_unstructured_text() {
use crate::parsers::fields::unstructured::parse_unstructured;
use crate::parsers::message::MessageStream;
use crate::parsers::MessageStream;
#[test]
fn parse_unstructured() {
let inputs = [
("Saying Hello\n", "Saying Hello", true),
("Re: Saying Hello\r\n", "Re: Saying Hello", true),
@@ -178,15 +159,43 @@ mod tests {
false,
),
("ハロー・ワールド \n", "ハロー・ワールド", true),
(
"[SUSPECTED SPAM]=?utf-8?B?VGhpcyBpcyB0aGUgb3JpZ2luYWwgc3ViamVjdA==?=\n",
"[SUSPECTED SPAM] This is the original subject",
true,
),
("Some text =?utf-8?Q??=here\n", "Some text here", true),
(
"=?ISO-8859-1?Q?a?==?ISO-8859-1?Q?b?==?ISO-8859-1?Q?c?= =?ISO-8859-1?Q?d?=\n",
"abcd",
true,
),
("=?utf-8?Q?Hello\n _there!?=\n", "Hello there!", true),
("=?utf-8?Q?Hello\r\n _there!?=\r\n", "Hello there!", true),
(
"=?utf-8?Q?Hello\r\n \t _there!?=\r\n",
"Hello there!",
true,
),
(
"[SUSPECTED SPAM]=?utf-8?B?VGhpcyBpcyB0aGUgb\n 3JpZ2luYWwgc3ViamVjdA==?=\n",
"[SUSPECTED SPAM] This is the original subject",
true,
),
(
"[SUSPECTED SPAM]=?utf-8?B?VGhpcyBpcyB0aGUgb\r\n 3JpZ2luYWwgc3ViamVjdA==?=\r\n",
"[SUSPECTED SPAM] This is the original subject",
true,
),
];
for input in inputs {
let str = input.0.to_string();
for (input, expected_result, _) in inputs {
assert_eq!(
parse_unstructured(&mut MessageStream::new(str.as_bytes()),).unwrap_text(),
input.1,
"Failed to parse '{:?}'",
input.0
MessageStream::new(input.as_bytes())
.parse_unstructured()
.unwrap_text(),
expected_result,
"Failed to parse '{input:?}'",
);
}
}
+250 -164
View File
@@ -11,124 +11,215 @@
use std::borrow::Cow;
use crate::{Header, HeaderName, HeaderValue, RfcHeader};
use crate::{Header, HeaderName, RfcHeader};
use super::{
fields::{
address::parse_address,
content_type::parse_content_type,
date::parse_date,
id::parse_id,
list::parse_comma_separared,
raw::{parse_and_ignore, parse_raw},
unstructured::parse_unstructured,
},
message::MessageStream,
};
use super::MessageStream;
#[derive(Debug, PartialEq, Eq)]
pub enum HeaderParserResult<'x> {
Rfc(RfcHeader),
Other(Cow<'x, str>),
Lf,
Eof,
}
pub fn parse_headers<'x>(headers: &mut Vec<Header<'x>>, stream: &mut MessageStream<'x>) -> bool {
loop {
let (bytes_read, result) = parse_header_name(&stream.data[stream.pos..]);
stream.pos += bytes_read;
match result {
HeaderParserResult::Rfc(name) => {
let (_, parser) = HDR_PARSER[name as usize];
let from_offset = stream.pos;
headers.push(Header {
name: HeaderName::Rfc(name),
value: parser(stream),
offset_start: from_offset,
offset_end: stream.pos,
});
}
HeaderParserResult::Other(name) => {
let from_offset = stream.pos;
parse_and_ignore(stream);
headers.push(Header {
name: HeaderName::Other(name),
value: HeaderValue::Text(String::from_utf8_lossy(
&stream.data[from_offset..stream.pos],
)),
offset_start: from_offset,
offset_end: stream.pos,
});
}
HeaderParserResult::Lf => return true,
HeaderParserResult::Eof => return false,
}
}
}
pub fn parse_header_name(data: &[u8]) -> (usize, HeaderParserResult) {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
let mut token_len: usize = 0;
let mut token_hash: usize = 0;
let mut last_ch: u8 = 0;
let mut bytes_read: usize = 0;
for ch in data.iter() {
bytes_read += 1;
match ch {
b':' => {
if token_start != 0 {
break;
impl<'x> MessageStream<'x> {
pub fn parse_headers(&mut self, headers: &mut Vec<Header<'x>>) -> bool {
loop {
loop {
match self.peek() {
Some(b'\n') => {
self.next();
return true;
}
None => return false,
Some(ch) if !ch.is_ascii_whitespace() => {
break;
}
_ => {
self.next();
}
}
}
b'\n' => {
return (bytes_read - 1, HeaderParserResult::Lf);
}
_ => {
if !(*ch).is_ascii_whitespace() {
if token_start == 0 {
token_start = bytes_read;
token_end = token_start;
} else {
token_end = bytes_read;
last_ch = *ch;
}
if let 0 | 9 = token_len {
token_hash += HDR_HASH[(*ch).to_ascii_lowercase() as usize] as usize;
let offset_field = self.offset();
if let Some(header_name) = self.parse_header_name() {
let from_offset = self.offset();
let value = if let HeaderName::Rfc(rfc_name) = &header_name {
match rfc_name {
RfcHeader::Subject
| RfcHeader::Comments
| RfcHeader::ContentDescription
| RfcHeader::ContentLocation
| RfcHeader::ContentTransferEncoding => self.parse_unstructured(),
RfcHeader::From
| RfcHeader::To
| RfcHeader::Cc
| RfcHeader::Bcc
| RfcHeader::ReplyTo
| RfcHeader::Sender
| RfcHeader::ResentTo
| RfcHeader::ResentFrom
| RfcHeader::ResentBcc
| RfcHeader::ResentCc
| RfcHeader::ResentSender
| RfcHeader::ListArchive
| RfcHeader::ListHelp
| RfcHeader::ListId
| RfcHeader::ListOwner
| RfcHeader::ListPost
| RfcHeader::ListSubscribe
| RfcHeader::ListUnsubscribe => self.parse_address(),
RfcHeader::Date | RfcHeader::ResentDate => self.parse_date(),
RfcHeader::MessageId
| RfcHeader::References
| RfcHeader::InReplyTo
| RfcHeader::ReturnPath
| RfcHeader::ContentId
| RfcHeader::ResentMessageId => self.parse_id(),
RfcHeader::Keywords | RfcHeader::ContentLanguage => {
self.parse_comma_separared()
}
RfcHeader::Received | RfcHeader::MimeVersion => self.parse_raw(),
RfcHeader::ContentType | RfcHeader::ContentDisposition => {
self.parse_content_type()
}
}
token_len += 1;
}
} else {
self.parse_raw()
};
headers.push(Header {
name: header_name,
value,
offset_field,
offset_start: from_offset,
offset_end: self.offset(),
});
} else if self.is_eof() {
return false;
}
}
}
if token_start != 0 {
let field = &data[token_start - 1..token_end];
pub fn parse_header_name(&mut self) -> Option<HeaderName<'x>> {
let mut token_start: usize = 0;
let mut token_end: usize = 0;
let mut token_len: usize = 0;
let mut token_hash: usize = 0;
let mut last_ch: u8 = 0;
if (2..=25).contains(&token_len) {
token_hash += token_len + HDR_HASH[last_ch.to_ascii_lowercase() as usize] as usize;
while let Some(&ch) = self.next() {
match ch {
b':' => {
if token_start != 0 {
break;
}
}
b'\n' => {
return None;
}
_ => {
if !ch.is_ascii_whitespace() {
if token_start == 0 {
token_start = self.offset();
token_end = token_start;
} else {
token_end = self.offset();
last_ch = ch;
}
if let 0 | 9 = token_len {
token_hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HDR_HASH.get_unchecked(ch.to_ascii_lowercase() as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HDR_HASH[ch.to_ascii_lowercase() as usize]
} as usize;
}
token_len += 1;
}
}
}
}
if token_start != 0 {
let field = self.bytes(token_start - 1..token_end);
if (2..=25).contains(&token_len) {
token_hash += token_len + {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HDR_HASH.get_unchecked(last_ch.to_ascii_lowercase() as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HDR_HASH[last_ch.to_ascii_lowercase() as usize]
} as usize;
if (4..=72).contains(&token_hash) {
let token_hash = token_hash - 4;
if field.eq_ignore_ascii_case(HDR_NAMES[token_hash]) {
return Some(HeaderName::Rfc(HDR_MAP[token_hash]));
}
}
}
Some(HeaderName::Other(String::from_utf8_lossy(field)))
} else {
None
}
}
}
impl<'x> HeaderName<'x> {
/// Parse a header name
pub fn parse(data: impl Into<Cow<'x, str>>) -> Option<HeaderName<'x>> {
let mut token_hash: usize = 0;
let mut last_ch: u8 = 0;
let data = data.into();
let data_ = data.as_bytes();
for (pos, &ch) in data_.iter().enumerate() {
if ch.is_ascii_alphanumeric() || [b'_', b'-'].contains(&ch) {
if let 0 | 9 = pos {
token_hash += {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HDR_HASH.get_unchecked(ch.to_ascii_lowercase() as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HDR_HASH[ch.to_ascii_lowercase() as usize]
} as usize;
}
last_ch = ch;
} else {
return None;
}
}
if (2..=25).contains(&data.len()) {
token_hash += data.len() + {
#[cfg(feature = "ludicrous_mode")]
unsafe {
*HDR_HASH.get_unchecked(last_ch.to_ascii_lowercase() as usize)
}
#[cfg(not(feature = "ludicrous_mode"))]
HDR_HASH[last_ch.to_ascii_lowercase() as usize]
} as usize;
if (4..=72).contains(&token_hash) {
let token_hash = token_hash - 4;
if field.eq_ignore_ascii_case(HDR_NAMES[token_hash]) {
return (bytes_read, HeaderParserResult::Rfc(HDR_MAP[token_hash]));
if data_.eq_ignore_ascii_case(HDR_NAMES[token_hash]) {
return HeaderName::Rfc(HDR_MAP[token_hash]).into();
}
}
}
return (
bytes_read,
HeaderParserResult::Other(String::from_utf8_lossy(field)),
);
} else {
(bytes_read, HeaderParserResult::Eof)
if !data.is_empty() {
HeaderName::Other(data).into()
} else {
None
}
}
}
@@ -140,83 +231,78 @@ impl From<RfcHeader> for u8 {
#[cfg(test)]
mod tests {
use crate::{parsers::header::parse_header_name, RfcHeader};
use super::HeaderParserResult;
use crate::{parsers::MessageStream, HeaderName, RfcHeader};
#[test]
fn header_name_parse() {
let inputs = [
("From: ", HeaderParserResult::Rfc(RfcHeader::From)),
("receiVED: ", HeaderParserResult::Rfc(RfcHeader::Received)),
(" subject : ", HeaderParserResult::Rfc(RfcHeader::Subject)),
("From: ", HeaderName::Rfc(RfcHeader::From)),
("receiVED: ", HeaderName::Rfc(RfcHeader::Received)),
(" subject : ", HeaderName::Rfc(RfcHeader::Subject)),
(
"X-Custom-Field : ",
HeaderParserResult::Other("X-Custom-Field".into()),
),
(" T : ", HeaderParserResult::Other("T".into())),
(
"mal formed: ",
HeaderParserResult::Other("mal formed".into()),
),
(
"MIME-version : ",
HeaderParserResult::Rfc(RfcHeader::MimeVersion),
HeaderName::Other("X-Custom-Field".into()),
),
(" T : ", HeaderName::Other("T".into())),
("mal formed: ", HeaderName::Other("mal formed".into())),
("MIME-version : ", HeaderName::Rfc(RfcHeader::MimeVersion)),
];
for input in inputs {
let str = input.0.to_string();
let (_, result) = parse_header_name(str.as_bytes());
assert_eq!(input.1, result, "Failed to parse '{:?}'", input.0);
for (input, expected_result) in inputs {
assert_eq!(
expected_result,
MessageStream::new(input.as_bytes())
.parse_header_name()
.unwrap(),
"Failed to parse '{input:?}'",
);
}
}
}
#[allow(clippy::type_complexity)]
static HDR_PARSER: &[(
bool,
for<'x, 'y> fn(&mut MessageStream<'x>) -> HeaderValue<'x>,
)] = &[
(false, parse_unstructured), // Subject = 0,
(false, parse_address), // From = 1,
(false, parse_address), // To = 2,
(false, parse_address), // Cc = 3,
(false, parse_date), // Date = 4,
(false, parse_address), // Bcc = 5,
(false, parse_address), // ReplyTo = 6,
(false, parse_address), // Sender = 7,
(true, parse_unstructured), // Comments = 8,
(false, parse_id), // InReplyTo = 9,
(true, parse_comma_separared), // Keywords = 10,
(true, parse_raw), // Received = 11,
(false, parse_id), // MessageId = 12,
(true, parse_id), // References = 13, (RFC 5322 recommends One)
(false, parse_id), // ReturnPath = 14,
(false, parse_raw), // MimeVersion = 15,
(false, parse_unstructured), // ContentDescription = 16,
(false, parse_id), // ContentId = 17,
(false, parse_comma_separared), // ContentLanguage = 18
(false, parse_unstructured), // ContentLocation = 19
(false, parse_unstructured), // ContentTransferEncoding = 20,
(false, parse_content_type), // ContentType = 21,
(false, parse_content_type), // ContentDisposition = 22,
(true, parse_address), // ResentTo = 23,
(true, parse_address), // ResentFrom = 24,
(true, parse_address), // ResentBcc = 25,
(true, parse_address), // ResentCc = 26,
(true, parse_address), // ResentSender = 27,
(true, parse_date), // ResentDate = 28,
(true, parse_id), // ResentMessageId = 29,
(false, parse_address), // ListArchive = 30,
(false, parse_address), // ListHelp = 31,
(false, parse_address), // ListId = 32,
(false, parse_address), // ListOwner = 33,
(false, parse_address), // ListPost = 34,
(false, parse_address), // ListSubscribe = 35,
(false, parse_address), // ListUnsubscribe = 36,
(true, parse_raw), // Other = 37,
];
/*
type ParserFnc<'x> = fn(&mut MessageStream<'x>) -> HeaderValue<'x>;
static HDR_PARSER: &[(bool, for<'x> fn(&mut MessageStream<'x>) -> HeaderValue<'x>] = &[
(false, MessageStream::parse_unstructured), // Subject = 0,
(false, MessageStream::parse_address), // From = 1,
(false, MessageStream::parse_address), // To = 2,
(false, MessageStream::parse_address), // Cc = 3,
(false, MessageStream::parse_date), // Date = 4,
(false, MessageStream::parse_address), // Bcc = 5,
(false, MessageStream::parse_address), // ReplyTo = 6,
(false, MessageStream::parse_address), // Sender = 7,
(true, MessageStream::parse_unstructured), // Comments = 8,
(false, MessageStream::parse_id), // InReplyTo = 9,
(true, MessageStream::parse_comma_separared), // Keywords = 10,
(true, MessageStream::parse_raw), // Received = 11,
(false, MessageStream::parse_id), // MessageId = 12,
(true, MessageStream::parse_id), // References = 13, (RFC 5322 recommends One)
(false, MessageStream::parse_id), // ReturnPath = 14,
(false, MessageStream::parse_raw), // MimeVersion = 15,
(false, MessageStream::parse_unstructured), // ContentDescription = 16,
(false, MessageStream::parse_id), // ContentId = 17,
(false, MessageStream::parse_comma_separared), // ContentLanguage = 18
(false, MessageStream::parse_unstructured), // ContentLocation = 19
(false, MessageStream::parse_unstructured), // ContentTransferEncoding = 20,
(false, MessageStream::parse_content_type), // ContentType = 21,
(false, MessageStream::parse_content_type), // ContentDisposition = 22,
(true, MessageStream::parse_address), // ResentTo = 23,
(true, MessageStream::parse_address), // ResentFrom = 24,
(true, MessageStream::parse_address), // ResentBcc = 25,
(true, MessageStream::parse_address), // ResentCc = 26,
(true, MessageStream::parse_address), // ResentSender = 27,
(true, MessageStream::parse_date), // ResentDate = 28,
(true, MessageStream::parse_id), // ResentMessageId = 29,
(false, MessageStream::parse_address), // ListArchive = 30,
(false, MessageStream::parse_address), // ListHelp = 31,
(false, MessageStream::parse_address), // ListId = 32,
(false, MessageStream::parse_address), // ListOwner = 33,
(false, MessageStream::parse_address), // ListPost = 34,
(false, MessageStream::parse_address), // ListSubscribe = 35,
(false, MessageStream::parse_address), // ListUnsubscribe = 36,
(true, MessageStream::parse_raw), // Other = 37,
];*/
static HDR_HASH: &[u8] = &[
73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+184 -226
View File
@@ -12,18 +12,14 @@
use std::borrow::Cow;
use crate::{
decoders::{
base64::decode_base64, charsets::map::get_charset_decoder,
quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult,
},
ContentType, Encoding, GetHeader, HeaderValue, Message, MessageAttachment, MessagePart,
MessagePartId, PartType, RfcHeader,
decoders::{charsets::map::charset_decoder, DecodeFnc},
ContentType, Encoding, GetHeader, HeaderValue, Message, MessagePart, MessagePartId, PartType,
RfcHeader,
};
use super::{
header::parse_headers,
mime::{get_bytes_to_boundary, seek_crlf, seek_next_part, skip_crlf, skip_multipart_end},
};
use super::MessageStream;
const MAX_NESTED_ENCODED: usize = 3;
#[derive(Debug, PartialEq)]
enum MimeType {
@@ -45,50 +41,18 @@ impl Default for MimeType {
}
}
fn result_to_string<'x>(
result: DecodeResult,
data: &'x [u8],
content_type: Option<&ContentType>,
) -> Cow<'x, str> {
match (
result,
content_type.and_then(|ct| {
ct.get_attribute("charset")
.and_then(|c| get_charset_decoder(c.as_bytes()))
}),
) {
(DecodeResult::Owned(vec), Some(charset_decoder)) => charset_decoder(&vec).into(),
(DecodeResult::Owned(vec), None) => String::from_utf8(vec)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into(),
(DecodeResult::Borrowed((from, to)), Some(charset_decoder)) => {
charset_decoder(&data[from..to]).into()
}
(DecodeResult::Borrowed((from, to)), None) => String::from_utf8_lossy(&data[from..to]),
(DecodeResult::Empty, _) => "\n".to_string().into(),
}
}
fn result_to_bytes(result: DecodeResult, data: &[u8]) -> Cow<[u8]> {
match result {
DecodeResult::Owned(vec) => Cow::Owned(vec),
DecodeResult::Borrowed((from, to)) => Cow::Borrowed(&data[from..to]),
DecodeResult::Empty => Cow::from(vec![b'?']),
}
}
#[inline(always)]
fn get_mime_type(
fn mime_type(
content_type: Option<&ContentType>,
parent_content_type: &MimeType,
) -> (bool, bool, bool, MimeType) {
if let Some(content_type) = content_type {
match content_type.get_type() {
match content_type.ctype() {
"multipart" => (
true,
false,
false,
match content_type.get_subtype() {
match content_type.subtype() {
Some("mixed") => MimeType::MultipartMixed,
Some("alternative") => MimeType::MultipartAlernative,
Some("related") => MimeType::MultipartRelated,
@@ -96,13 +60,13 @@ fn get_mime_type(
_ => MimeType::Other,
},
),
"text" => match content_type.get_subtype() {
"text" => match content_type.subtype() {
Some("plain") => (false, true, true, MimeType::TextPlain),
Some("html") => (false, true, true, MimeType::TextHtml),
_ => (false, false, true, MimeType::TextOther),
},
"image" | "audio" | "video" => (false, true, false, MimeType::Inline),
"message" if [Some("rfc822"), Some("global")].contains(&content_type.get_subtype()) => {
"message" if [Some("rfc822"), Some("global")].contains(&content_type.subtype()) => {
(false, false, false, MimeType::Message)
}
_ => (false, false, false, MimeType::Other),
@@ -114,24 +78,6 @@ fn get_mime_type(
}
}
/*#[inline(always)]
fn add_missing_type<'x>(
headers: &mut Vec<Header<'x>>,
c_type: Cow<'x, str>,
c_subtype: Cow<'x, str>,
) {
if headers.is_empty() {
headers.insert(
RfcHeader::ContentType,
HeaderValue::ContentType(ContentType {
c_type,
c_subtype: Some(c_subtype),
attributes: None,
}),
);
}
}*/
#[derive(Default, Debug)]
struct MessageParserState {
mime_type: MimeType,
@@ -165,17 +111,6 @@ impl MessageParserState {
}
}
pub struct MessageStream<'x> {
pub data: &'x [u8],
pub pos: usize,
}
impl<'x> MessageStream<'x> {
pub fn new(data: &'x [u8]) -> MessageStream<'x> {
MessageStream { data, pos: 0 }
}
}
impl<'x> Message<'x> {
fn new() -> Message<'x> {
Message {
@@ -195,6 +130,10 @@ impl<'x> Message<'x> {
/// if no headers are found None is returned.
///
pub fn parse(raw_message: &'x [u8]) -> Option<Message<'x>> {
Message::parse_(raw_message, MAX_NESTED_ENCODED)
}
fn parse_(raw_message: &'x [u8], depth: usize) -> Option<Message<'x>> {
let mut stream = MessageStream::new(raw_message);
let mut message = Message::new();
@@ -206,36 +145,33 @@ impl<'x> Message<'x> {
'outer: loop {
// Parse headers
state.offset_header = stream.pos;
if !parse_headers(&mut part_headers, &mut stream) {
state.offset_header = stream.offset();
if !stream.parse_headers(&mut part_headers) {
break;
}
state.offset_body = stream.offset();
state.parts += 1;
state.sub_part_ids.push(message.parts.len());
let content_type = part_headers
.get_rfc(&RfcHeader::ContentType)
.rfc(&RfcHeader::ContentType)
.and_then(|c| c.as_content_type_ref());
let (is_multipart, mut is_inline, mut is_text, mut mime_type) =
get_mime_type(content_type, &state.mime_type);
mime_type(content_type, &state.mime_type);
if is_multipart {
if let Some(mime_boundary) =
content_type.map_or_else(|| None, |f| f.get_attribute("boundary"))
content_type.map_or_else(|| None, |f| f.attribute("boundary"))
{
//let mime_boundary = format!("\n--{}", mime_boundary).into_bytes();
let mime_boundary = format!("--{}", mime_boundary).into_bytes();
state.offset_body = seek_crlf(&stream, stream.pos);
if seek_next_part(&mut stream, mime_boundary.as_ref()) {
if stream.seek_next_part(mime_boundary.as_bytes()) {
let part_id = message.parts.len();
let new_state = MessageParserState {
in_alternative: state.in_alternative
|| mime_type == MimeType::MultipartAlernative,
mime_type,
mime_boundary: mime_boundary.into(),
mime_boundary: mime_boundary.as_bytes().to_vec().into(),
html_parts: message.html_body.len(),
text_parts: message.text_body.len(),
need_html_body: state.need_html_body,
@@ -255,7 +191,7 @@ impl<'x> Message<'x> {
});
state_stack.push((state, None));
state = new_state;
skip_crlf(&mut stream);
stream.skip_crlf();
continue;
} else {
mime_type = MimeType::TextOther;
@@ -264,25 +200,24 @@ impl<'x> Message<'x> {
}
}
skip_crlf(&mut stream);
state.offset_body = stream.pos;
let (mut encoding, decode_fnc): (Encoding, DecodeFnc) = match part_headers
.rfc(&RfcHeader::ContentTransferEncoding)
{
Some(HeaderValue::Text(encoding)) if encoding.eq_ignore_ascii_case("base64") => {
(Encoding::Base64, MessageStream::decode_base64_mime)
}
Some(HeaderValue::Text(encoding))
if encoding.eq_ignore_ascii_case("quoted-printable") =>
{
(
Encoding::QuotedPrintable,
MessageStream::decode_quoted_printable_mime,
)
}
_ => (Encoding::None, MessageStream::mime_part),
};
let (is_binary, mut encoding, decode_fnc): (bool, Encoding, DecodeFnc) =
match part_headers.get_rfc(&RfcHeader::ContentTransferEncoding) {
Some(HeaderValue::Text(encoding))
if encoding.eq_ignore_ascii_case("base64") =>
{
(false, Encoding::Base64, decode_base64)
}
Some(HeaderValue::Text(encoding))
if encoding.eq_ignore_ascii_case("quoted-printable") =>
{
(false, Encoding::QuotedPrintable, decode_quoted_printable)
}
_ => (true, Encoding::None, get_bytes_to_boundary),
};
if is_binary && mime_type == MimeType::Message {
if mime_type == MimeType::Message && encoding == Encoding::None {
let new_state = MessageParserState {
mime_type: MimeType::Message,
mime_boundary: state.mime_boundary.take(),
@@ -307,107 +242,36 @@ impl<'x> Message<'x> {
continue;
}
let (bytes_read, mut bytes) = decode_fnc(
&stream,
stream.pos,
state
.mime_boundary
.as_ref()
.map_or_else(|| &[][..], |b| &b[..]),
false,
let (offset_end, mut bytes) = decode_fnc(
&mut stream,
state.mime_boundary.as_deref().unwrap_or(&b""[..]),
);
// Attempt to recover contents of an invalid message
let is_encoding_problem = bytes_read == 0;
let mut is_encoding_problem = offset_end == usize::MAX;
if is_encoding_problem {
encoding = Encoding::None;
mime_type = MimeType::TextOther;
is_inline = false;
is_text = true;
let did_recover = if !(stream.pos >= stream.data.len()
|| (is_binary && state.mime_boundary.is_none()))
{
// Get raw MIME part
let (bytes_read, r_bytes) = if !is_binary {
get_bytes_to_boundary(
&stream,
stream.pos,
state
.mime_boundary
.as_ref()
.map_or_else(|| &[][..], |b| &b[..]),
false,
)
} else {
(0, DecodeResult::Empty)
};
let (offset_end, boundary_found) =
stream.seek_part_end(state.mime_boundary.as_deref());
state.offset_end = offset_end;
bytes = stream.data[state.offset_body..state.offset_end].into();
if bytes_read == 0 {
// 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);
if bytes_read > 0 {
bytes = r_bytes;
stream.pos += bytes_read;
state.mime_boundary = None;
true
} else {
false
}
} else {
false
}
} else {
bytes = r_bytes;
stream.pos += bytes_read;
true
}
} else {
false
};
if did_recover {
mime_type = MimeType::TextOther;
is_inline = false;
is_text = true;
} else {
// Could not recover error, add part and abort
message.parts.push(MessagePart {
headers: std::mem::take(&mut part_headers),
encoding: Encoding::None,
is_encoding_problem: true,
body: PartType::Binary((&[][..]).into()),
offset_header: state.offset_header,
offset_body: state.offset_body,
offset_end: stream.pos,
});
break;
if !boundary_found {
state.mime_boundary = None;
}
} else {
stream.pos += bytes_read;
state.offset_end = offset_end;
}
// Obtain offset end
state.offset_end = if let Some(mime_boundary) = &state.mime_boundary {
let pos = stream.pos.saturating_sub(mime_boundary.len());
std::cmp::max(
stream.data.get(pos - 2).map_or(pos - 1, |&ch| {
if ch == b'\r' {
pos - 2
} else {
pos - 1
}
}),
state.offset_body,
)
} else {
stream.pos
};
let body_part = if mime_type != MimeType::Message {
let is_inline = is_inline
&& part_headers
.get_rfc(&RfcHeader::ContentDisposition)
.map_or_else(|| true, |d| !d.get_content_type().is_attachment())
.rfc(&RfcHeader::ContentDisposition)
.map_or_else(|| true, |d| !d.content_type().is_attachment())
&& (state.parts == 1
|| (state.mime_type != MimeType::MultipartRelated
&& (mime_type == MimeType::Inline
@@ -439,7 +303,23 @@ impl<'x> Message<'x> {
};
if is_text {
let text = result_to_string(bytes, stream.data, content_type);
let text = match (
bytes,
content_type.and_then(|ct| {
ct.attribute("charset")
.and_then(|c| charset_decoder(c.as_bytes()))
}),
) {
(Cow::Owned(vec), Some(charset_decoder)) => charset_decoder(&vec).into(),
(Cow::Owned(vec), None) => String::from_utf8(vec)
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
.into(),
(Cow::Borrowed(bytes), Some(charset_decoder)) => {
charset_decoder(bytes).into()
}
(Cow::Borrowed(bytes), None) => String::from_utf8_lossy(bytes),
};
let is_html = mime_type == MimeType::TextHtml;
if add_to_html && !is_html {
@@ -471,7 +351,6 @@ impl<'x> Message<'x> {
message.attachments.push(message.parts.len());
let bytes = result_to_bytes(bytes, stream.data);
if !is_inline {
PartType::Binary(bytes)
} else {
@@ -480,7 +359,28 @@ impl<'x> Message<'x> {
}
} else {
message.attachments.push(message.parts.len());
PartType::Message(MessageAttachment::Raw(result_to_bytes(bytes, stream.data)))
if depth != 0 {
if let Some(nested_message) = Message::parse_(bytes.as_ref(), depth - 1) {
PartType::Message(Message {
html_body: nested_message.html_body,
text_body: nested_message.text_body,
attachments: nested_message.attachments,
parts: nested_message
.parts
.into_iter()
.map(|p| p.into_owned())
.collect(),
raw_message: bytes.into_owned().into(),
})
} else {
is_encoding_problem = true;
PartType::Binary(bytes)
}
} else {
is_encoding_problem = true;
PartType::Binary(bytes)
}
};
// Add part
@@ -504,7 +404,7 @@ impl<'x> Message<'x> {
.mime_boundary
.as_ref()
.map(|b| {
let pos = stream.pos.saturating_sub(b.len());
let pos = stream.offset().saturating_sub(b.len() + 2);
stream.data.get(pos - 2).map_or(pos - 1, |&ch| {
if ch == b'\r' {
pos - 2
@@ -513,13 +413,12 @@ impl<'x> Message<'x> {
}
})
})
.unwrap_or(stream.pos);
message.raw_message =
raw_message[state.offset_header..offset_end].as_ref().into();
.unwrap_or_else(|| stream.offset());
message.raw_message = raw_message.into();
//raw_message[state.offset_header..offset_end].as_ref().into();
if let Some(part) = prev_message.parts.get_mut(state.part_id) {
part.body =
PartType::Message(MessageAttachment::Parsed(Box::new(message)));
part.body = PartType::Message(message);
part.offset_end = offset_end;
} else {
debug_assert!(false, "Invalid part ID, could not find message.");
@@ -534,7 +433,7 @@ impl<'x> Message<'x> {
}
}
if skip_multipart_end(&mut stream) {
if stream.is_multipart_end() {
// End of MIME part reached
if MimeType::MultipartAlernative == state.mime_type
@@ -561,35 +460,38 @@ impl<'x> Message<'x> {
}
if let Some(part) = message.parts.get_mut(state.part_id) {
// Update end offset
part.offset_end = seek_crlf(&stream, stream.pos);
// Add headers and substructure to parent part
part.body =
PartType::Multipart(std::mem::take(&mut state.sub_part_ids));
// Restore ancestor's state
if let Some((prev_state, _)) = state_stack.pop() {
state = prev_state;
if let Some(ref mime_boundary) = state.mime_boundary {
// Ancestor has a MIME boundary, seek it.
if let Some(offset) =
stream.seek_next_part_offset(mime_boundary)
{
part.offset_end = offset;
continue 'inner;
}
}
}
// This part has no boundary, update end offset
part.offset_end = stream.offset();
} else {
debug_assert!(false, "Invalid part ID, could not find multipart.");
}
if let Some((prev_state, _)) = state_stack.pop() {
// Restore ancestor's state
state = prev_state;
if let Some(ref mime_boundary) = state.mime_boundary {
// Ancestor has a MIME boundary, seek it.
if seek_next_part(&mut stream, mime_boundary) {
continue 'inner;
}
}
}
break 'outer;
} else {
skip_crlf(&mut stream);
// Headers of next part expected next, break inner look.
break 'inner;
}
}
} else if stream.pos >= stream.data.len() {
} else if stream.offset() >= stream.data.len() {
break 'outer;
}
}
@@ -597,18 +499,18 @@ impl<'x> Message<'x> {
// Corrupted MIME message, try to recover whatever is possible.
while let Some((prev_state, prev_message)) = state_stack.pop() {
if let Some(mut prev_message) = prev_message {
message.raw_message = raw_message[state.offset_header..stream.pos].as_ref().into();
message.raw_message = raw_message.into(); //raw_message[state.offset_header..stream.offset()].as_ref().into();
if let Some(part) = prev_message.parts.get_mut(state.part_id) {
part.body = PartType::Message(MessageAttachment::Parsed(Box::new(message)));
part.offset_end = stream.pos;
part.body = PartType::Message(message);
part.offset_end = stream.offset();
} else {
debug_assert!(false, "Invalid part ID, could not find message.");
}
message = prev_message;
} else if let Some(part) = message.parts.get_mut(state.part_id) {
part.offset_end = stream.pos;
part.offset_end = stream.offset();
part.body = PartType::Multipart(state.sub_part_ids);
} else {
debug_assert!(false, "This should not have happened.");
@@ -621,6 +523,18 @@ impl<'x> Message<'x> {
if !message.is_empty() {
message.parts[0].offset_end = message.raw_message.len();
Some(message)
} else if !part_headers.is_empty() {
// Message without a body
message.parts.push(MessagePart {
headers: part_headers,
encoding: Encoding::None,
is_encoding_problem: true,
body: PartType::Text("".into()),
offset_header: 0,
offset_body: message.raw_message.len(),
offset_end: message.raw_message.len(),
});
Some(message)
} else {
None
}
@@ -645,12 +559,14 @@ mod tests {
for file_name in fs::read_dir(&test_dir).unwrap() {
let mut file_name = file_name.unwrap().path();
if file_name.extension().map_or(false, |e| e == "eml") {
let raw_message = fs::read(&file_name).unwrap();
let raw_original = fs::read(&file_name).unwrap();
tests_run += 1;
// Test without CRs
let raw_message = strip_crlf(&raw_original);
file_name.set_extension("json");
let expected_result = fs::read(&file_name).unwrap();
tests_run += 1;
let message = Message::parse(&raw_message).unwrap();
let json_message = serde_json::to_string_pretty(&message).unwrap();
@@ -662,6 +578,23 @@ mod tests {
file_name.display()
);
}
// Test with CRs
let raw_message = add_crlf(&raw_original);
file_name.set_extension("crlf.json");
let expected_result = fs::read(&file_name).unwrap();
let message = Message::parse(&raw_message).unwrap();
let json_message = serde_json::to_string_pretty(&message).unwrap();
if json_message.as_bytes() != expected_result {
file_name.set_extension("crlf.failed");
fs::write(&file_name, json_message.as_bytes()).unwrap();
panic!(
"Test failed, parsed message saved to {}",
file_name.display()
);
}
}
}
@@ -672,4 +605,29 @@ mod tests {
);
}
}
fn add_crlf(bytes: &[u8]) -> Vec<u8> {
let mut result = Vec::with_capacity(bytes.len());
let mut last_ch = 0;
for &ch in bytes {
if ch == b'\n' && last_ch != b'\r' {
result.push(b'\r');
}
result.push(ch);
last_ch = ch;
}
result
}
fn strip_crlf(bytes: &[u8]) -> Vec<u8> {
let mut result = Vec::with_capacity(bytes.len());
for &ch in bytes {
if !ch != b'\r' {
result.push(ch);
}
}
result
}
}
+131 -127
View File
@@ -9,160 +9,164 @@
* except according to those terms.
*/
use crate::decoders::DecodeResult;
use std::borrow::Cow;
use super::message::MessageStream;
use super::MessageStream;
pub(crate) fn seek_next_part(stream: &mut MessageStream, boundary: &[u8]) -> bool {
if !boundary.is_empty() {
let mut pos = stream.pos;
impl<'x> MessageStream<'x> {
pub fn seek_next_part(&mut self, boundary: &[u8]) -> bool {
if !boundary.is_empty() {
let mut last_ch = 0;
let mut match_count = 0;
self.checkpoint();
for ch in &stream.data[pos..] {
pos += 1;
if ch == &boundary[match_count] {
match_count += 1;
if match_count == boundary.len() {
stream.pos = pos;
while let Some(&ch) = self.next() {
if ch == b'-' && last_ch == b'-' && self.try_skip(boundary) {
return true;
} else {
continue;
}
} else if match_count > 0 {
if ch == &boundary[0] {
match_count = 1;
continue;
} else {
match_count = 0;
}
last_ch = ch;
}
self.restore();
}
false
}
false
}
pub fn seek_next_part_offset(&mut self, boundary: &[u8]) -> Option<usize> {
let mut last_ch = b'\n';
let mut offset_pos = self.offset();
self.checkpoint();
pub(crate) fn get_bytes_to_boundary<'x>(
stream: &MessageStream<'x>,
start_pos: usize,
boundary: &[u8],
_is_word: bool,
) -> (usize, DecodeResult) {
let mut read_pos = start_pos;
if !boundary.is_empty() {
let mut match_count = 0;
let mut cr_pos = 0;
let mut lf_pos = 0;
for ch in &stream.data[read_pos..] {
read_pos += 1;
if ch == &boundary[match_count] {
match_count += 1;
if match_count == boundary.len() {
if is_boundary_end(stream, read_pos) {
let mut match_pos = read_pos - match_count;
if match_pos > 0 && match_pos == lf_pos {
if lf_pos == cr_pos + 1 {
match_pos -= 2;
} else {
match_pos -= 1;
}
}
return (
read_pos - start_pos,
if start_pos < match_pos {
DecodeResult::Borrowed((start_pos, match_pos))
} else {
DecodeResult::Empty
},
);
} else {
match_count = 0;
}
}
continue;
} else if match_count > 0 {
if ch == &boundary[0] {
match_count = 1;
continue;
while let Some(&ch) = self.next() {
if ch == b'\n' {
offset_pos = if last_ch == b'\r' {
self.offset() - 2
} else {
match_count = 0;
}
self.offset() - 1
};
} else if ch == b'-' && last_ch == b'-' && self.try_skip(boundary) {
return offset_pos.into();
}
if ch == &b'\r' {
cr_pos = read_pos;
} else if ch == &b'\n' {
lf_pos = read_pos;
last_ch = ch;
}
self.restore();
None
}
pub fn mime_part(&mut self, boundary: &[u8]) -> (usize, Cow<'x, [u8]>) {
let mut last_ch = b'\n';
let mut before_last_ch = 0;
let start_pos = self.offset();
let mut end_pos = self.offset();
self.checkpoint();
while let Some(&ch) = self.next() {
if ch == b'\n' {
end_pos = if last_ch == b'\r' {
self.offset() - 2
} else {
self.offset() - 1
};
} else if ch == b'-'
&& !boundary.is_empty()
&& last_ch == b'-'
&& self.try_skip(boundary)
{
if before_last_ch != b'\n' {
end_pos = self.offset() - boundary.len() - 2;
}
return (end_pos, self.bytes(start_pos..end_pos).into());
}
before_last_ch = last_ch;
last_ch = ch;
}
(0, DecodeResult::Empty)
} else if start_pos < stream.data.len() {
(
stream.data.len() - start_pos,
DecodeResult::Borrowed((start_pos, stream.data.len())),
if boundary.is_empty() {
self.offset()
} else {
self.restore();
usize::MAX
},
self.bytes(start_pos..self.len()).into(),
)
} else {
(0, DecodeResult::Empty)
}
}
#[inline(always)]
pub(crate) fn is_boundary_end(stream: &MessageStream, pos: usize) -> bool {
matches!(
stream.data.get(pos..),
Some([b'\n' | b'\r' | b' ' | b'\t', ..]) | Some([b'-', b'-', ..]) | Some([]) | None
)
}
pub fn seek_part_end(&mut self, boundary: Option<&[u8]>) -> (usize, bool) {
let mut last_ch = b'\n';
let mut before_last_ch = 0;
let mut end_pos = self.offset();
pub(crate) fn skip_multipart_end(stream: &mut MessageStream) -> bool {
match stream.data.get(stream.pos..stream.pos + 2) {
Some(b"--") => {
if let Some(byte) = stream.data.get(stream.pos + 2) {
if !(*byte).is_ascii_whitespace() {
return false;
if let Some(boundary) = boundary {
while let Some(&ch) = self.next() {
if ch == b'\n' {
end_pos = if last_ch == b'\r' {
self.offset() - 2
} else {
self.offset() - 1
};
} else if ch == b'-' && last_ch == b'-' && self.try_skip(boundary) {
if before_last_ch != b'\n' {
end_pos = self.offset() - boundary.len() - 2;
}
return (end_pos, true);
}
}
stream.pos += 2;
true
}
_ => false,
}
}
#[inline(always)]
pub(crate) fn skip_crlf(stream: &mut MessageStream) {
for ch in &stream.data[stream.pos..] {
match ch {
b'\r' | b' ' | b'\t' => stream.pos += 1,
b'\n' => {
stream.pos += 1;
break;
before_last_ch = last_ch;
last_ch = ch;
}
_ => break,
}
}
}
#[inline(always)]
pub(crate) 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,
(self.offset(), false)
} else {
self.seek_end();
(self.offset(), true)
}
}
start_pos
pub fn is_multipart_end(&mut self) -> bool {
self.checkpoint();
match (self.next(), self.peek()) {
(Some(&a), Some(&&b)) if a == b'\r' && b == b'\n' => {
self.next();
false
}
(Some(&a), Some(&&b)) if a == b'-' && b == b'-' => {
self.next();
true
}
(Some(&a), _) if a == b'\n' => false,
(Some(&a), _) if a.is_ascii_whitespace() => {
self.skip_crlf();
false
}
_ => {
self.restore();
false
}
}
}
#[inline(always)]
pub fn skip_crlf(&mut self) {
while let Some(ch) = self.peek() {
match ch {
b'\r' | b' ' | b'\t' => {
self.next();
}
b'\n' => {
self.next();
break;
}
_ => break,
}
}
}
}
+141
View File
@@ -9,8 +9,149 @@
* except according to those terms.
*/
use std::{iter::Peekable, ops::Range, slice::Iter};
pub mod fields;
pub mod header;
pub mod message;
pub mod mime;
pub mod preview;
pub struct MessageStream<'x> {
data: &'x [u8],
iter: Peekable<Iter<'x, u8>>,
pos: usize,
restore_pos: usize,
}
impl<'x> MessageStream<'x> {
pub fn new(data: &'x [u8]) -> MessageStream<'x> {
MessageStream {
data,
iter: data.iter().peekable(),
pos: 0,
restore_pos: 0,
}
}
#[inline(always)]
pub fn peek(&mut self) -> Option<&&u8> {
self.iter.peek()
}
#[inline(always)]
pub fn offset(&self) -> usize {
std::cmp::min(self.pos, self.data.len())
}
#[inline(always)]
pub fn remaining(&self) -> usize {
self.data.len() - self.offset()
}
#[inline(always)]
pub fn checkpoint(&mut self) {
self.restore_pos = self.offset();
}
#[inline(always)]
pub fn restore(&mut self) {
self.iter = self.data[self.restore_pos..].iter().peekable();
self.pos = self.restore_pos;
self.restore_pos = 0;
}
#[inline(always)]
pub fn reset(&mut self) {
self.restore_pos = 0;
}
#[inline(always)]
pub fn peek_bytes(&self, len: usize) -> Option<&[u8]> {
let pos = self.offset();
self.data.get(pos..pos + len)
}
#[inline(always)]
pub fn peek_char(&mut self, ch: u8) -> bool {
matches!(self.peek(), Some(&&ch_) if ch_ == ch)
}
#[inline(always)]
pub fn skip_bytes(&mut self, len: usize) {
self.pos += len;
self.iter = self.data[self.pos..].iter().peekable();
}
#[inline(always)]
pub fn try_skip(&mut self, bytes: &[u8]) -> bool {
if self.peek_bytes(bytes.len()) == Some(bytes) {
self.skip_bytes(bytes.len());
true
} else {
false
}
}
#[inline(always)]
pub fn try_skip_char(&mut self, ch: u8) -> bool {
if self.peek_char(ch) {
self.next();
true
} else {
false
}
}
#[inline(always)]
pub fn bytes(&self, range: Range<usize>) -> &'x [u8] {
&self.data[range]
}
#[inline(always)]
pub fn seek_end(&mut self) {
self.pos = self.data.len();
self.iter = [][..].iter().peekable();
}
#[inline(always)]
pub fn next_is_space(&mut self) -> bool {
matches!(self.next(), Some(b' ' | b'\t'))
}
#[inline(always)]
pub fn peek_next_is_space(&mut self) -> bool {
matches!(self.peek(), Some(b' ' | b'\t'))
}
#[inline(always)]
pub fn try_next_is_space(&mut self) -> bool {
if self.peek_next_is_space() {
self.next();
true
} else {
false
}
}
#[allow(clippy::len_without_is_empty)]
#[inline(always)]
pub fn len(&self) -> usize {
self.data.len()
}
#[inline(always)]
pub fn is_eof(&mut self) -> bool {
self.iter.peek().is_none()
}
}
impl<'x> Iterator for MessageStream<'x> {
type Item = &'x u8;
#[inline(always)]
fn next(&mut self) -> Option<Self::Item> {
self.pos += 1;
self.iter.next()
}
}
+4 -4
View File
@@ -13,11 +13,11 @@ use std::borrow::Cow;
use crate::decoders::html::html_to_text;
pub fn preview_html<'x, 'y>(html: Cow<'y, str>, max_len: usize) -> Cow<'x, str> {
pub fn preview_html<'x>(html: Cow<'_, str>, max_len: usize) -> Cow<'x, str> {
preview_text(html_to_text(html.as_ref()).into(), max_len)
}
pub fn preview_text<'x, 'y>(text: Cow<'y, str>, mut max_len: usize) -> Cow<'x, str> {
pub fn preview_text<'x>(text: Cow<'_, str>, mut max_len: usize) -> Cow<'x, str> {
if text.len() > max_len {
let add_dots = max_len > 6;
if add_dots {
@@ -39,11 +39,11 @@ pub fn preview_text<'x, 'y>(text: Cow<'y, str>, mut max_len: usize) -> Cow<'x, s
}
}
pub fn truncate_text<'x, 'y>(text: Cow<'y, str>, max_len: usize) -> Cow<'x, str> {
pub fn truncate_text<'x>(text: Cow<'_, str>, max_len: usize) -> Cow<'x, str> {
preview_text(text, max_len)
}
pub fn truncate_html<'x, 'y>(html: Cow<'y, str>, mut max_len: usize) -> Cow<'x, str> {
pub fn truncate_html<'x>(html: Cow<'_, str>, mut max_len: usize) -> Cow<'x, str> {
if html.len() > max_len {
let add_dots = max_len > 6;
if add_dots {
+12 -12
View File
@@ -65,7 +65,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_from(),
message.from(),
&HeaderValue::Address(Addr::new(
"Art Vandelay (Vandelay Industries)".into(),
"art@vandelay.com"
@@ -73,7 +73,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_to(),
message.to(),
&HeaderValue::GroupList(vec![
Group::new(
"Colleagues",
@@ -90,17 +90,17 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_date().unwrap().to_rfc3339(),
message.date().unwrap().to_rfc3339(),
"2021-11-20T14:22:01-08:00"
);
assert_eq!(
message.get_subject().unwrap(),
message.subject().unwrap(),
"Why not both importing AND exporting? ☺"
);
assert_eq!(
message.get_html_body(0).unwrap(),
message.body_html(0).unwrap(),
concat!(
"<html><p>I was thinking about quitting the &ldquo;exporting&rdquo; to ",
"focus just on the &ldquo;importing&rdquo;,</p><p>but then I thought,",
@@ -109,36 +109,36 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
);
assert_eq!(
message.get_text_body(0).unwrap(),
message.body_text(0).unwrap(),
concat!(
"I was thinking about quitting the “exporting” to focus just on the",
" “importing”,\nbut then I thought, why not do both? ☺\n"
)
);
let nested_message = message.get_attachment(0).unwrap().get_message().unwrap();
let nested_message = message.attachment(0).unwrap().message().unwrap();
assert_eq!(
nested_message.get_subject().unwrap(),
nested_message.subject().unwrap(),
"Exporting my book about coffee tables"
);
assert_eq!(
nested_message.get_text_body(0).unwrap(),
nested_message.body_text(0).unwrap(),
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
);
assert_eq!(
nested_message.get_html_body(0).unwrap(),
nested_message.body_html(0).unwrap(),
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
);
let nested_attachment = nested_message.get_attachment(0).unwrap();
let nested_attachment = nested_message.attachment(0).unwrap();
assert_eq!(nested_attachment.len(), 42);
assert_eq!(
nested_attachment.get_attachment_name().unwrap(),
nested_attachment.attachment_name().unwrap(),
"Book about ☕ tables.gif"
);
}
File diff suppressed because it is too large Load Diff
+19 -5
View File
@@ -17,6 +17,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -30,6 +31,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -40,6 +42,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -60,6 +63,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -70,6 +74,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -80,6 +85,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -99,6 +105,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 291
},
@@ -109,6 +116,7 @@
"value": {
"Text": "base64"
},
"offset_field": 291,
"offset_start": 317,
"offset_end": 326
},
@@ -128,6 +136,7 @@
]
}
},
"offset_field": 326,
"offset_start": 346,
"offset_end": 385
},
@@ -136,8 +145,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 385,
"offset_start": 396,
"offset_end": 409
},
@@ -146,8 +156,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 409,
"offset_start": 427,
"offset_end": 436
},
@@ -156,8 +167,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 436,
"offset_start": 445,
"offset_end": 498
},
@@ -166,8 +178,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 498,
"offset_start": 509,
"offset_end": 518
},
@@ -176,8 +189,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 518,
"offset_start": 528,
"offset_end": 576
}
+196
View File
@@ -0,0 +1,196 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"AddressList": [
{
"name": "Joe Blow",
"address": "jblow@example.com"
},
{
"name": "Jürgen Schmürgen",
"address": "schmuergen@example.com"
}
]
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 149
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 149,
"offset_start": 157,
"offset_end": 228
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 18,
"second": 39,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 228,
"offset_start": 233,
"offset_end": 267
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com"
},
"offset_field": 267,
"offset_start": 278,
"offset_end": 328
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 328,
"offset_start": 341,
"offset_end": 347
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"utf-7"
]
]
}
},
"offset_field": 347,
"offset_start": 360,
"offset_end": 392
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 392,
"offset_start": 418,
"offset_end": 437
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 437,
"offset_start": 448,
"offset_end": 461
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 461,
"offset_start": 479,
"offset_end": 488
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 488,
"offset_start": 497,
"offset_end": 550
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 550,
"offset_start": 561,
"offset_end": 570
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 570,
"offset_start": 580,
"offset_end": 628
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
},
"offset_header": 0,
"offset_body": 630,
"offset_end": 1525
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 39
},
@@ -38,6 +39,7 @@
}
]
},
"offset_field": 39,
"offset_start": 42,
"offset_end": 146
},
@@ -48,6 +50,7 @@
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 146,
"offset_start": 154,
"offset_end": 224
},
@@ -68,6 +71,7 @@
"tz_minute": 0
}
},
"offset_field": 224,
"offset_start": 229,
"offset_end": 262
},
@@ -78,6 +82,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com"
},
"offset_field": 262,
"offset_start": 273,
"offset_end": 322
},
@@ -88,6 +93,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 322,
"offset_start": 335,
"offset_end": 340
},
@@ -107,6 +113,7 @@
]
}
},
"offset_field": 340,
"offset_start": 353,
"offset_end": 383
},
@@ -117,6 +124,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 383,
"offset_start": 409,
"offset_end": 427
},
@@ -125,8 +133,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\n"
"Text": "3 (Normal)"
},
"offset_field": 427,
"offset_start": 438,
"offset_end": 450
},
@@ -135,8 +144,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\n"
"Text": "Normal"
},
"offset_field": 450,
"offset_start": 468,
"offset_end": 476
},
@@ -145,8 +155,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 476,
"offset_start": 485,
"offset_end": 537
},
@@ -155,8 +166,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\n"
"Text": "Normal"
},
"offset_field": 537,
"offset_start": 548,
"offset_end": 556
},
@@ -165,8 +177,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 556,
"offset_start": 566,
"offset_end": 613
}
+168
View File
@@ -0,0 +1,168 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 0,
"minute": 31,
"second": 0,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz Müller",
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 290
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 290,
"offset_start": 295,
"offset_end": 332
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 332,
"offset_start": 340,
"offset_end": 387
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 387,
"offset_start": 400,
"offset_end": 406
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "html",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 406,
"offset_start": 419,
"offset_end": 453
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 453,
"offset_start": 479,
"offset_end": 498
}
],
"is_encoding_problem": false,
"body": {
"Html": "<html>\n<font face=\"Arial, Helvetica\" size=5 color=\"#0000FF\"><b>Die Hasen und die\nFrösche<br>\n<br>\n</font></b><font face=\"Arial, Helvetica\">Die Hasen klagten einst über\nihre mißliche Lage; &quot;wir leben&quot;, sprach ein Redner, &quot;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.&quot; <br>\n<br>\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. <br>\n<br>\n&quot;Halt&quot;, rief nun eben dieser Sprecher, &quot;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.&quot; <br>\n<br>\n</font></html>\n\n"
},
"offset_header": 0,
"offset_body": 500,
"offset_end": 1499
}
]
}
+14 -3
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -44,8 +47,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -66,6 +70,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -79,6 +84,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 290
},
@@ -92,6 +98,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 290,
"offset_start": 295,
"offset_end": 332
},
@@ -102,6 +109,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 332,
"offset_start": 340,
"offset_end": 387
},
@@ -112,6 +120,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 387,
"offset_start": 400,
"offset_end": 406
},
@@ -131,6 +140,7 @@
]
}
},
"offset_field": 406,
"offset_start": 419,
"offset_end": 453
},
@@ -141,6 +151,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 453,
"offset_start": 479,
"offset_end": 498
}
+244
View File
@@ -0,0 +1,244 @@
{
"html_body": [
2
],
"text_body": [
1
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519002557.00a88870@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 0,
"minute": 29,
"second": 55,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz Müller",
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 290
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 290,
"offset_start": 295,
"offset_end": 332
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 332,
"offset_start": 340,
"offset_end": 387
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 387,
"offset_start": 400,
"offset_end": 406
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "alternative",
"attributes": [
[
"boundary",
"=====================_714967308==_.ALT"
]
]
}
},
"offset_field": 406,
"offset_start": 419,
"offset_end": 496
}
],
"is_encoding_problem": false,
"body": {
"Multipart": [
1,
2
]
},
"offset_header": 0,
"offset_body": 498,
"offset_end": 2627
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 540,
"offset_start": 553,
"offset_end": 588
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 588,
"offset_start": 614,
"offset_end": 633
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
},
"offset_header": 540,
"offset_body": 635,
"offset_end": 1444
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "html",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 1488,
"offset_start": 1501,
"offset_end": 1535
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 1535,
"offset_start": 1561,
"offset_end": 1580
}
],
"is_encoding_problem": false,
"body": {
"Html": "<html>\n<font face=\"Arial, Helvetica\" size=5 color=\"#0000FF\"><b>Die Hasen und die\nFrösche<br>\n<br>\n</font></b><font face=\"Arial, Helvetica\">Die Hasen klagten einst über\nihre mißliche Lage; &quot;wir leben&quot;, sprach ein Redner, &quot;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.&quot; <br>\n<br>\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. <br>\n<br>\n&quot;Halt&quot;, rief nun eben dieser Sprecher, &quot;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.&quot; <br>\n<br>\n</font></html>\n"
},
"offset_header": 1488,
"offset_body": 1582,
"offset_end": 2579
}
]
}
+17 -3
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519002557.00a88870@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -44,8 +47,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -66,6 +70,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -79,6 +84,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 290
},
@@ -92,6 +98,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 290,
"offset_start": 295,
"offset_end": 332
},
@@ -102,6 +109,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 332,
"offset_start": 340,
"offset_end": 387
},
@@ -112,6 +120,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 387,
"offset_start": 400,
"offset_end": 406
},
@@ -131,6 +140,7 @@
]
}
},
"offset_field": 406,
"offset_start": 419,
"offset_end": 496
}
@@ -164,6 +174,7 @@
]
}
},
"offset_field": 540,
"offset_start": 553,
"offset_end": 588
},
@@ -174,6 +185,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 588,
"offset_start": 614,
"offset_end": 633
}
@@ -204,6 +216,7 @@
]
}
},
"offset_field": 1488,
"offset_start": 1501,
"offset_end": 1535
},
@@ -214,6 +227,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1535,
"offset_start": 1561,
"offset_end": 1580
}
+157
View File
@@ -0,0 +1,157 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "5 (Lowest)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 194
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 1,
"minute": 13,
"second": 19,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Joe Blow",
"address": "blow@example.com"
}
},
"offset_field": 233,
"offset_start": 236,
"offset_end": 266
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 266,
"offset_start": 271,
"offset_end": 308
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "The Hare and the Tortoise"
},
"offset_field": 308,
"offset_start": 316,
"offset_end": 344
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 344,
"offset_start": 357,
"offset_end": 363
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"us-ascii"
]
]
}
},
"offset_field": 363,
"offset_start": 376,
"offset_end": 409
}
],
"is_encoding_problem": false,
"body": {
"Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race. \r\n\r\n"
},
"offset_header": 0,
"offset_body": 411,
"offset_end": 1177
}
]
}
+13 -3
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -44,8 +47,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 5 (Lowest)\r\n"
"Text": "5 (Lowest)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 194
},
@@ -66,6 +70,7 @@
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
@@ -79,6 +84,7 @@
"address": "blow@example.com"
}
},
"offset_field": 233,
"offset_start": 236,
"offset_end": 266
},
@@ -92,6 +98,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 266,
"offset_start": 271,
"offset_end": 308
},
@@ -102,6 +109,7 @@
"value": {
"Text": "The Hare and the Tortoise"
},
"offset_field": 308,
"offset_start": 316,
"offset_end": 344
},
@@ -112,6 +120,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 344,
"offset_start": 357,
"offset_end": 363
},
@@ -131,6 +140,7 @@
]
}
},
"offset_field": 363,
"offset_start": 376,
"offset_end": 409
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz Müller",
"address": "mueller@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 96
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 96,
"offset_start": 104,
"offset_end": 175
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 20,
"second": 24,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 175,
"offset_start": 180,
"offset_end": 214
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com"
},
"offset_field": 214,
"offset_start": 225,
"offset_end": 275
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 275,
"offset_start": 288,
"offset_end": 294
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"utf-7"
]
]
}
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 339
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 339,
"offset_start": 365,
"offset_end": 384
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 384,
"offset_start": 395,
"offset_end": 408
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 408,
"offset_start": 426,
"offset_end": 435
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 435,
"offset_start": 444,
"offset_end": 497
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 497,
"offset_start": 508,
"offset_end": 517
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 517,
"offset_start": 527,
"offset_end": 575
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n"
},
"offset_header": 0,
"offset_body": 577,
"offset_end": 1470
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 96
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 96,
"offset_start": 104,
"offset_end": 175
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 175,
"offset_start": 180,
"offset_end": 214
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com"
},
"offset_field": 214,
"offset_start": 225,
"offset_end": 275
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 275,
"offset_start": 288,
"offset_end": 294
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 339
},
@@ -111,6 +118,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 339,
"offset_start": 365,
"offset_end": 384
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 384,
"offset_start": 395,
"offset_end": 408
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 408,
"offset_start": 426,
"offset_end": 435
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 435,
"offset_start": 444,
"offset_end": 497
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 497,
"offset_start": 508,
"offset_end": 517
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 517,
"offset_start": 527,
"offset_end": 575
}
File diff suppressed because it is too large Load Diff
+23 -5
View File
@@ -18,6 +18,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -31,6 +32,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -41,6 +43,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -61,6 +64,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -71,6 +75,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -81,6 +86,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -100,6 +106,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 331
},
@@ -108,8 +115,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 331,
"offset_start": 342,
"offset_end": 355
},
@@ -118,8 +126,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 355,
"offset_start": 373,
"offset_end": 382
},
@@ -128,8 +137,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 382,
"offset_start": 391,
"offset_end": 444
},
@@ -138,8 +148,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 444,
"offset_start": 455,
"offset_end": 464
},
@@ -148,8 +159,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 464,
"offset_start": 474,
"offset_end": 522
}
@@ -183,6 +195,7 @@
]
}
},
"offset_field": 617,
"offset_start": 630,
"offset_end": 665
},
@@ -193,6 +206,7 @@
"value": {
"Text": "base64"
},
"offset_field": 665,
"offset_start": 691,
"offset_end": 700
},
@@ -212,6 +226,7 @@
]
}
},
"offset_field": 700,
"offset_start": 720,
"offset_end": 760
}
@@ -1568,6 +1583,7 @@
]
}
},
"offset_field": 2625,
"offset_start": 2638,
"offset_end": 2672
},
@@ -1578,6 +1594,7 @@
"value": {
"Text": "base64"
},
"offset_field": 2672,
"offset_start": 2698,
"offset_end": 2707
},
@@ -1597,6 +1614,7 @@
]
}
},
"offset_field": 2707,
"offset_start": 2727,
"offset_end": 2766
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Jürgen Schmürgen",
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 112
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 112,
"offset_start": 120,
"offset_end": 194
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 15,
"second": 35,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com"
},
"offset_field": 233,
"offset_start": 244,
"offset_end": 294
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 313
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 313,
"offset_start": 326,
"offset_end": 363
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 408
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 408,
"offset_start": 419,
"offset_end": 432
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 432,
"offset_start": 450,
"offset_end": 459
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 459,
"offset_start": 468,
"offset_end": 521
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 521,
"offset_start": 532,
"offset_end": 541
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 541,
"offset_start": 551,
"offset_end": 599
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
},
"offset_header": 0,
"offset_body": 601,
"offset_end": 1410
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 112
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 112,
"offset_start": 120,
"offset_end": 194
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com"
},
"offset_field": 233,
"offset_start": 244,
"offset_end": 294
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 313
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 313,
"offset_start": 326,
"offset_end": 363
},
@@ -111,6 +118,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 408
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 408,
"offset_start": 419,
"offset_end": 432
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 432,
"offset_start": 450,
"offset_end": 459
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 459,
"offset_start": 468,
"offset_end": 521
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 521,
"offset_start": 532,
"offset_end": 541
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 541,
"offset_start": 551,
"offset_end": 599
}
File diff suppressed because it is too large Load Diff
+28 -5
View File
@@ -23,6 +23,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -36,6 +37,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 99
},
@@ -46,6 +48,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 99,
"offset_start": 107,
"offset_end": 148
},
@@ -66,6 +69,7 @@
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
@@ -76,6 +80,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
@@ -86,6 +91,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
@@ -105,6 +111,7 @@
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 354
},
@@ -113,8 +120,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 354,
"offset_start": 365,
"offset_end": 378
},
@@ -123,8 +131,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 378,
"offset_start": 396,
"offset_end": 405
},
@@ -133,8 +142,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 405,
"offset_start": 414,
"offset_end": 467
},
@@ -143,8 +153,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 467,
"offset_start": 478,
"offset_end": 487
},
@@ -153,8 +164,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 487,
"offset_start": 497,
"offset_end": 545
}
@@ -190,6 +202,7 @@
]
}
},
"offset_field": 640,
"offset_start": 653,
"offset_end": 690
},
@@ -200,6 +213,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 690,
"offset_start": 716,
"offset_end": 735
}
@@ -230,6 +244,7 @@
]
}
},
"offset_field": 1583,
"offset_start": 1596,
"offset_end": 1631
},
@@ -240,6 +255,7 @@
"value": {
"Text": "base64"
},
"offset_field": 1631,
"offset_start": 1657,
"offset_end": 1666
},
@@ -259,6 +275,7 @@
]
}
},
"offset_field": 1666,
"offset_start": 1686,
"offset_end": 1726
}
@@ -1615,6 +1632,7 @@
]
}
},
"offset_field": 3591,
"offset_start": 3604,
"offset_end": 3640
},
@@ -1625,6 +1643,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3640,
"offset_start": 3666,
"offset_end": 3675
},
@@ -1644,6 +1663,7 @@
]
}
},
"offset_field": 3675,
"offset_start": 3695,
"offset_end": 3736
}
@@ -2973,6 +2993,7 @@
]
}
},
"offset_field": 5563,
"offset_start": 5576,
"offset_end": 5610
},
@@ -2983,6 +3004,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5610,
"offset_start": 5636,
"offset_end": 5645
},
@@ -3002,6 +3024,7 @@
]
}
},
"offset_field": 5645,
"offset_start": 5665,
"offset_end": 5704
}
+183
View File
@@ -0,0 +1,183 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "Disposition-Notification-To"
},
"value": {
"Text": "<dwsauder@example.com>"
},
"offset_field": 113,
"offset_start": 141,
"offset_end": 166
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 166,
"offset_start": 175,
"offset_end": 223
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "1 (Highest)"
},
"offset_field": 223,
"offset_start": 234,
"offset_end": 248
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 1,
"minute": 6,
"second": 18,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 248,
"offset_start": 253,
"offset_end": 287
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Jürgen Schmürgen",
"address": "jschmuergen@example.com"
}
},
"offset_field": 287,
"offset_start": 290,
"offset_end": 373
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 373,
"offset_start": 378,
"offset_end": 415
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 415,
"offset_start": 423,
"offset_end": 468
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 468,
"offset_start": 481,
"offset_end": 487
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
],
[
"format",
"flowed"
]
]
}
},
"offset_field": 487,
"offset_start": 500,
"offset_end": 550
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 550,
"offset_start": 576,
"offset_end": 595
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein \nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, \nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der \nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; \nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein \nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, \nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
},
"offset_header": 0,
"offset_body": 597,
"offset_end": 1422
}
]
}
+16 -4
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "Disposition-Notification-To"
},
"value": {
"Text": " <dwsauder@example.com>\r\n"
"Text": "<dwsauder@example.com>"
},
"offset_field": 113,
"offset_start": 141,
"offset_end": 166
},
@@ -44,8 +47,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 166,
"offset_start": 175,
"offset_end": 223
},
@@ -54,8 +58,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 1 (Highest)\r\n"
"Text": "1 (Highest)"
},
"offset_field": 223,
"offset_start": 234,
"offset_end": 248
},
@@ -76,6 +81,7 @@
"tz_minute": 0
}
},
"offset_field": 248,
"offset_start": 253,
"offset_end": 287
},
@@ -89,6 +95,7 @@
"address": "jschmuergen@example.com"
}
},
"offset_field": 287,
"offset_start": 290,
"offset_end": 373
},
@@ -102,6 +109,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 373,
"offset_start": 378,
"offset_end": 415
},
@@ -112,6 +120,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 415,
"offset_start": 423,
"offset_end": 468
},
@@ -122,6 +131,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 468,
"offset_start": 481,
"offset_end": 487
},
@@ -145,6 +155,7 @@
]
}
},
"offset_field": 487,
"offset_start": 500,
"offset_end": 550
},
@@ -155,6 +166,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 550,
"offset_start": 576,
"offset_end": 595
}
+168
View File
@@ -0,0 +1,168 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "1 (Highest)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 195
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 1,
"minute": 10,
"second": 27,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 195,
"offset_start": 200,
"offset_end": 234
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz M�ller",
"address": "mueller@example.com"
}
},
"offset_field": 234,
"offset_start": 237,
"offset_end": 274
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 274,
"offset_start": 279,
"offset_end": 316
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Fr�sche"
},
"offset_field": 316,
"offset_start": 324,
"offset_end": 352
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 352,
"offset_start": 365,
"offset_end": 371
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 371,
"offset_start": 384,
"offset_end": 419
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "8bit"
},
"offset_field": 419,
"offset_start": 445,
"offset_end": 452
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n\r\n\r\n"
},
"offset_header": 0,
"offset_body": 454,
"offset_end": 1203
}
]
}
+14 -3
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -44,8 +47,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 1 (Highest)\r\n"
"Text": "1 (Highest)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 195
},
@@ -66,6 +70,7 @@
"tz_minute": 0
}
},
"offset_field": 195,
"offset_start": 200,
"offset_end": 234
},
@@ -79,6 +84,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 234,
"offset_start": 237,
"offset_end": 274
},
@@ -92,6 +98,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 274,
"offset_start": 279,
"offset_end": 316
},
@@ -102,6 +109,7 @@
"value": {
"Text": "Die Hasen und die Fr�sche"
},
"offset_field": 316,
"offset_start": 324,
"offset_end": 352
},
@@ -112,6 +120,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 352,
"offset_start": 365,
"offset_end": 371
},
@@ -131,6 +140,7 @@
]
}
},
"offset_field": 371,
"offset_start": 384,
"offset_end": 419
},
@@ -141,6 +151,7 @@
"value": {
"Text": "8bit"
},
"offset_field": 419,
"offset_start": 445,
"offset_end": 452
}
+157
View File
@@ -0,0 +1,157 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 0,
"minute": 17,
"second": 39,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Jürgen Schmürgen",
"address": "jschmuergen@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 299
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 299,
"offset_start": 304,
"offset_end": 341
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 341,
"offset_start": 349,
"offset_end": 396
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 396,
"offset_start": 409,
"offset_end": 415
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 415,
"offset_start": 428,
"offset_end": 463
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 463,
"offset_start": 489,
"offset_end": 508
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n"
},
"offset_header": 0,
"offset_body": 510,
"offset_end": 1321
}
]
}
+12 -2
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -24,8 +25,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -34,8 +36,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -56,6 +59,7 @@
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
@@ -69,6 +73,7 @@
"address": "jschmuergen@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 299
},
@@ -82,6 +87,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 299,
"offset_start": 304,
"offset_end": 341
},
@@ -92,6 +98,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 341,
"offset_start": 349,
"offset_end": 396
},
@@ -102,6 +109,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 396,
"offset_start": 409,
"offset_end": 415
},
@@ -121,6 +129,7 @@
]
}
},
"offset_field": 415,
"offset_start": 428,
"offset_end": 463
},
@@ -131,6 +140,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 463,
"offset_start": 489,
"offset_end": 508
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz Müller",
"address": "mueller@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 101
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 101,
"offset_start": 109,
"offset_end": 185
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 30,
"second": 20,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 185,
"offset_start": 190,
"offset_end": 224
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com"
},
"offset_field": 224,
"offset_start": 235,
"offset_end": 285
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 285,
"offset_start": 298,
"offset_end": 304
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"Windows-1252"
]
]
}
},
"offset_field": 304,
"offset_start": 317,
"offset_end": 356
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 356,
"offset_start": 382,
"offset_end": 401
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 401,
"offset_start": 412,
"offset_end": 425
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 425,
"offset_start": 443,
"offset_end": 452
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 452,
"offset_start": 461,
"offset_end": 514
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 514,
"offset_start": 525,
"offset_end": 534
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 534,
"offset_start": 544,
"offset_end": 592
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n"
},
"offset_header": 0,
"offset_body": 594,
"offset_end": 1401
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 101
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 101,
"offset_start": 109,
"offset_end": 185
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 185,
"offset_start": 190,
"offset_end": 224
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com"
},
"offset_field": 224,
"offset_start": 235,
"offset_end": 285
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 285,
"offset_start": 298,
"offset_end": 304
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 304,
"offset_start": 317,
"offset_end": 356
},
@@ -111,6 +118,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 356,
"offset_start": 382,
"offset_end": 401
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 401,
"offset_start": 412,
"offset_end": 425
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 425,
"offset_start": 443,
"offset_end": 452
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 452,
"offset_start": 461,
"offset_end": 514
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 514,
"offset_start": 525,
"offset_end": 534
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 534,
"offset_start": 544,
"offset_end": 592
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Jürgen Schmürgen",
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 112
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 112,
"offset_start": 120,
"offset_end": 194
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 13,
"second": 51,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com"
},
"offset_field": 233,
"offset_start": 244,
"offset_end": 294
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 313
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 313,
"offset_start": 326,
"offset_end": 363
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "8bit"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 396
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 396,
"offset_start": 407,
"offset_end": 420
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 420,
"offset_start": 438,
"offset_end": 447
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 447,
"offset_start": 456,
"offset_end": 509
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 509,
"offset_start": 520,
"offset_end": 529
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 529,
"offset_start": 539,
"offset_end": 587
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n"
},
"offset_header": 0,
"offset_body": 589,
"offset_end": 1341
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 112
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
},
"offset_field": 112,
"offset_start": 120,
"offset_end": 194
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 194,
"offset_start": 199,
"offset_end": 233
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com"
},
"offset_field": 233,
"offset_start": 244,
"offset_end": 294
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 313
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 313,
"offset_start": 326,
"offset_end": 363
},
@@ -111,6 +118,7 @@
"value": {
"Text": "8bit"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 396
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 396,
"offset_start": 407,
"offset_end": 420
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 420,
"offset_start": 438,
"offset_end": 447
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 447,
"offset_start": 456,
"offset_end": 509
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 509,
"offset_start": 520,
"offset_end": 529
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 529,
"offset_start": 539,
"offset_end": 587
}
+266
View File
@@ -0,0 +1,266 @@
{
"html_body": [
2
],
"text_body": [
1
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Joe Blow",
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 38,
"second": 28,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "alternative",
"attributes": [
[
"boundary",
"----=_NextPart_000_0005_01BFC037.799BEF60"
]
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 337
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 337,
"offset_start": 348,
"offset_end": 361
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 361,
"offset_start": 379,
"offset_end": 388
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 388,
"offset_start": 397,
"offset_end": 450
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 450,
"offset_start": 461,
"offset_end": 470
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 470,
"offset_start": 480,
"offset_end": 528
}
],
"is_encoding_problem": false,
"body": {
"Multipart": [
1,
2
]
},
"offset_header": 0,
"offset_body": 530,
"offset_end": 2903
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 623,
"offset_start": 636,
"offset_end": 673
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 673,
"offset_start": 699,
"offset_end": 718
}
],
"is_encoding_problem": false,
"body": {
"Text": "\nThe Hare and the Tortoise \n \nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \n \nSlow but steady wins the race. \n\n"
},
"offset_header": 623,
"offset_body": 720,
"offset_end": 1521
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "html",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 1568,
"offset_start": 1581,
"offset_end": 1617
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 1617,
"offset_start": 1643,
"offset_end": 1662
}
],
"is_encoding_problem": false,
"body": {
"Html": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<HTML><HEAD>\n<META content=\"text/html; charset=iso-8859-1\" http-equiv=Content-Type>\n<META content=\"MSHTML 5.00.2314.1000\" name=GENERATOR></HEAD>\n<BODY>\n<DIV><FONT face=Arial size=2><BR>The Hare and the Tortoise <BR>&nbsp;<BR>A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:&nbsp; \"Though you be swift as the wind, I will beat you in a \nrace.\"&nbsp; 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.&nbsp; On the day appointed for the race the two started \ntogether.&nbsp; The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.&nbsp; The Hare, lying down by \nthe wayside, fell fast asleep.&nbsp; 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.&nbsp; <BR>&nbsp;<BR>Slow but steady wins the race.&nbsp; \n<BR></FONT></DIV></BODY></HTML>\n"
},
"offset_header": 1568,
"offset_body": 1664,
"offset_end": 2854
}
]
}
+21 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 337
},
@@ -109,8 +116,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 337,
"offset_start": 348,
"offset_end": 361
},
@@ -119,8 +127,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 361,
"offset_start": 379,
"offset_end": 388
},
@@ -129,8 +138,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 388,
"offset_start": 397,
"offset_end": 450
},
@@ -139,8 +149,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 450,
"offset_start": 461,
"offset_end": 470
},
@@ -149,8 +160,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 470,
"offset_start": 480,
"offset_end": 528
}
@@ -184,6 +196,7 @@
]
}
},
"offset_field": 623,
"offset_start": 636,
"offset_end": 673
},
@@ -194,6 +207,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 673,
"offset_start": 699,
"offset_end": 718
}
@@ -224,6 +238,7 @@
]
}
},
"offset_field": 1568,
"offset_start": 1581,
"offset_end": 1617
},
@@ -234,6 +249,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1617,
"offset_start": 1643,
"offset_end": 1662
}
File diff suppressed because it is too large Load Diff
+33 -3
View File
@@ -21,6 +21,7 @@
"value": {
"Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -29,8 +30,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -39,8 +41,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -49,8 +52,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -71,6 +75,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -84,6 +89,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 288
},
@@ -97,6 +103,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 288,
"offset_start": 293,
"offset_end": 330
},
@@ -107,6 +114,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 330,
"offset_start": 338,
"offset_end": 383
},
@@ -117,6 +125,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 383,
"offset_start": 396,
"offset_end": 402
},
@@ -136,6 +145,7 @@
]
}
},
"offset_field": 402,
"offset_start": 415,
"offset_end": 482
}
@@ -174,6 +184,7 @@
]
}
},
"offset_field": 522,
"offset_start": 535,
"offset_end": 640
}
@@ -208,6 +219,7 @@
]
}
},
"offset_field": 684,
"offset_start": 697,
"offset_end": 774
}
@@ -241,6 +253,7 @@
]
}
},
"offset_field": 818,
"offset_start": 831,
"offset_end": 866
},
@@ -251,6 +264,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 866,
"offset_start": 892,
"offset_end": 911
}
@@ -281,6 +295,7 @@
]
}
},
"offset_field": 1790,
"offset_start": 1803,
"offset_end": 1837
},
@@ -291,6 +306,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1837,
"offset_start": 1863,
"offset_end": 1882
}
@@ -321,6 +337,7 @@
]
}
},
"offset_field": 3204,
"offset_start": 3217,
"offset_end": 3250
},
@@ -331,6 +348,7 @@
"value": {
"Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2"
},
"offset_field": 3250,
"offset_start": 3261,
"offset_end": 3316
},
@@ -341,6 +359,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3316,
"offset_start": 3342,
"offset_end": 3351
},
@@ -360,6 +379,7 @@
]
}
},
"offset_field": 3351,
"offset_start": 3371,
"offset_end": 3405
}
@@ -1716,6 +1736,7 @@
]
}
},
"offset_field": 5265,
"offset_start": 5278,
"offset_end": 5311
},
@@ -1726,6 +1747,7 @@
"value": {
"Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3"
},
"offset_field": 5311,
"offset_start": 5322,
"offset_end": 5377
},
@@ -1736,6 +1758,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5377,
"offset_start": 5403,
"offset_end": 5412
},
@@ -1755,6 +1778,7 @@
]
}
},
"offset_field": 5412,
"offset_start": 5432,
"offset_end": 5466
}
@@ -3239,6 +3263,7 @@
]
}
},
"offset_field": 7544,
"offset_start": 7557,
"offset_end": 7590
},
@@ -3249,6 +3274,7 @@
"value": {
"Text": "base64"
},
"offset_field": 7590,
"offset_start": 7616,
"offset_end": 7625
},
@@ -3268,6 +3294,7 @@
]
}
},
"offset_field": 7625,
"offset_start": 7645,
"offset_end": 7683
}
@@ -4624,6 +4651,7 @@
]
}
},
"offset_field": 9539,
"offset_start": 9552,
"offset_end": 9586
},
@@ -4634,6 +4662,7 @@
"value": {
"Text": "base64"
},
"offset_field": 9586,
"offset_start": 9612,
"offset_end": 9621
},
@@ -4653,6 +4682,7 @@
]
}
},
"offset_field": 9621,
"offset_start": 9641,
"offset_end": 9680
}
File diff suppressed because it is too large Load Diff
+17 -2
View File
@@ -19,6 +19,7 @@
"value": {
"Text": "4.2.0.58.20000519005150.00a85230@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -27,8 +28,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -37,8 +39,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -59,6 +62,7 @@
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
@@ -72,6 +76,7 @@
"address": "jschmuergen@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 295
},
@@ -85,6 +90,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 295,
"offset_start": 300,
"offset_end": 337
},
@@ -95,6 +101,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 337,
"offset_start": 345,
"offset_end": 390
},
@@ -105,6 +112,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 390,
"offset_start": 403,
"offset_end": 409
},
@@ -124,6 +132,7 @@
]
}
},
"offset_field": 409,
"offset_start": 422,
"offset_end": 489
}
@@ -158,6 +167,7 @@
]
}
},
"offset_field": 529,
"offset_start": 542,
"offset_end": 577
},
@@ -168,6 +178,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 577,
"offset_start": 603,
"offset_end": 622
}
@@ -198,6 +209,7 @@
]
}
},
"offset_field": 1473,
"offset_start": 1486,
"offset_end": 1534
},
@@ -217,6 +229,7 @@
]
}
},
"offset_field": 1534,
"offset_start": 1554,
"offset_end": 1592
}
@@ -2177,6 +2190,7 @@
]
}
},
"offset_field": 3563,
"offset_start": 3576,
"offset_end": 3631
},
@@ -2196,6 +2210,7 @@
]
}
},
"offset_field": 3631,
"offset_start": 3651,
"offset_end": 3696
}
File diff suppressed because it is too large Load Diff
+18 -2
View File
@@ -19,6 +19,7 @@
"value": {
"Text": "4.2.0.58.20000519004755.00a86100@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -27,8 +28,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -37,8 +39,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -59,6 +62,7 @@
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
@@ -72,6 +76,7 @@
"address": "jschmuergen@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 257
},
@@ -85,6 +90,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 257,
"offset_start": 262,
"offset_end": 299
},
@@ -95,6 +101,7 @@
"value": {
"Text": "The Hare and the Tortoise"
},
"offset_field": 299,
"offset_start": 307,
"offset_end": 335
},
@@ -105,6 +112,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 335,
"offset_start": 348,
"offset_end": 354
},
@@ -124,6 +132,7 @@
]
}
},
"offset_field": 354,
"offset_start": 367,
"offset_end": 434
}
@@ -158,6 +167,7 @@
]
}
},
"offset_field": 474,
"offset_start": 487,
"offset_end": 520
}
@@ -188,6 +198,7 @@
]
}
},
"offset_field": 1326,
"offset_start": 1339,
"offset_end": 1373
},
@@ -198,6 +209,7 @@
"value": {
"Text": "x-uuencode"
},
"offset_field": 1373,
"offset_start": 1399,
"offset_end": 1412
},
@@ -217,6 +229,7 @@
]
}
},
"offset_field": 1412,
"offset_start": 1432,
"offset_end": 1471
}
@@ -2102,6 +2115,7 @@
]
}
},
"offset_field": 3367,
"offset_start": 3380,
"offset_end": 3413
},
@@ -2112,6 +2126,7 @@
"value": {
"Text": "x-uuencode"
},
"offset_field": 3413,
"offset_start": 3439,
"offset_end": 3452
},
@@ -2131,6 +2146,7 @@
]
}
},
"offset_field": 3452,
"offset_start": 3472,
"offset_end": 3510
}
File diff suppressed because it is too large Load Diff
+26 -3
View File
@@ -19,6 +19,7 @@
"value": {
"Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -27,8 +28,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -37,8 +39,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -47,8 +50,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -69,6 +73,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -82,6 +87,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 288
},
@@ -95,6 +101,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 288,
"offset_start": 293,
"offset_end": 330
},
@@ -105,6 +112,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 330,
"offset_start": 338,
"offset_end": 383
},
@@ -115,6 +123,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 383,
"offset_start": 396,
"offset_end": 402
},
@@ -138,6 +147,7 @@
]
}
},
"offset_field": 402,
"offset_start": 415,
"offset_end": 520
}
@@ -172,6 +182,7 @@
]
}
},
"offset_field": 564,
"offset_start": 577,
"offset_end": 654
}
@@ -205,6 +216,7 @@
]
}
},
"offset_field": 698,
"offset_start": 711,
"offset_end": 746
},
@@ -215,6 +227,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 746,
"offset_start": 772,
"offset_end": 791
}
@@ -245,6 +258,7 @@
]
}
},
"offset_field": 1673,
"offset_start": 1686,
"offset_end": 1720
},
@@ -255,6 +269,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1720,
"offset_start": 1746,
"offset_end": 1765
}
@@ -285,6 +300,7 @@
]
}
},
"offset_field": 3095,
"offset_start": 3108,
"offset_end": 3141
},
@@ -295,6 +311,7 @@
"value": {
"Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0"
},
"offset_field": 3141,
"offset_start": 3152,
"offset_end": 3207
},
@@ -305,6 +322,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3207,
"offset_start": 3233,
"offset_end": 3242
},
@@ -324,6 +342,7 @@
]
}
},
"offset_field": 3242,
"offset_start": 3262,
"offset_end": 3296
}
@@ -1680,6 +1699,7 @@
]
}
},
"offset_field": 5156,
"offset_start": 5169,
"offset_end": 5201
},
@@ -1690,6 +1710,7 @@
"value": {
"Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1"
},
"offset_field": 5201,
"offset_start": 5212,
"offset_end": 5267
},
@@ -1700,6 +1721,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5267,
"offset_start": 5293,
"offset_end": 5302
},
@@ -1719,6 +1741,7 @@
]
}
},
"offset_field": 5302,
"offset_start": 5322,
"offset_end": 5355
}
File diff suppressed because it is too large Load Diff
+28 -5
View File
@@ -22,6 +22,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -35,6 +36,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -45,6 +47,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -65,6 +68,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -75,6 +79,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -85,6 +90,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -104,6 +110,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 331
},
@@ -112,8 +119,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 331,
"offset_start": 342,
"offset_end": 355
},
@@ -122,8 +130,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 355,
"offset_start": 373,
"offset_end": 382
},
@@ -132,8 +141,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 382,
"offset_start": 391,
"offset_end": 444
},
@@ -142,8 +152,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 444,
"offset_start": 455,
"offset_end": 464
},
@@ -152,8 +163,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 464,
"offset_start": 474,
"offset_end": 522
}
@@ -188,6 +200,7 @@
]
}
},
"offset_field": 617,
"offset_start": 630,
"offset_end": 710
}
@@ -221,6 +234,7 @@
]
}
},
"offset_field": 759,
"offset_start": 772,
"offset_end": 809
},
@@ -231,6 +245,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 809,
"offset_start": 835,
"offset_end": 854
}
@@ -261,6 +276,7 @@
]
}
},
"offset_field": 1704,
"offset_start": 1717,
"offset_end": 1753
},
@@ -271,6 +287,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1753,
"offset_start": 1779,
"offset_end": 1798
}
@@ -301,6 +318,7 @@
]
}
},
"offset_field": 3086,
"offset_start": 3099,
"offset_end": 3135
},
@@ -311,6 +329,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3135,
"offset_start": 3161,
"offset_end": 3170
},
@@ -330,6 +349,7 @@
]
}
},
"offset_field": 3170,
"offset_start": 3190,
"offset_end": 3231
}
@@ -1659,6 +1679,7 @@
]
}
},
"offset_field": 5058,
"offset_start": 5071,
"offset_end": 5105
},
@@ -1669,6 +1690,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5105,
"offset_start": 5131,
"offset_end": 5140
},
@@ -1688,6 +1710,7 @@
]
}
},
"offset_field": 5140,
"offset_start": 5160,
"offset_end": 5199
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "J�rgen Schm�rgen",
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 8,
"second": 29,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "8bit"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 350
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 350,
"offset_start": 361,
"offset_end": 374
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 374,
"offset_start": 392,
"offset_end": 401
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 401,
"offset_start": 410,
"offset_end": 463
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 463,
"offset_start": 474,
"offset_end": 483
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 483,
"offset_start": 493,
"offset_end": 541
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n"
},
"offset_header": 0,
"offset_body": 543,
"offset_end": 1295
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
@@ -111,6 +118,7 @@
"value": {
"Text": "8bit"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 350
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 350,
"offset_start": 361,
"offset_end": 374
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 374,
"offset_start": 392,
"offset_end": 401
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 401,
"offset_start": 410,
"offset_end": 463
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 463,
"offset_start": 474,
"offset_end": 483
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 483,
"offset_start": 493,
"offset_end": 541
}
File diff suppressed because it is too large Load Diff
+32 -5
View File
@@ -23,6 +23,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -36,6 +37,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -46,6 +48,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -66,6 +69,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -76,6 +80,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -86,6 +91,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -105,6 +111,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 331
},
@@ -113,8 +120,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 331,
"offset_start": 342,
"offset_end": 355
},
@@ -123,8 +131,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 355,
"offset_start": 373,
"offset_end": 382
},
@@ -133,8 +142,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 382,
"offset_start": 391,
"offset_end": 444
},
@@ -143,8 +153,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 444,
"offset_start": 455,
"offset_end": 464
},
@@ -153,8 +164,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 464,
"offset_start": 474,
"offset_end": 522
}
@@ -189,6 +201,7 @@
]
}
},
"offset_field": 617,
"offset_start": 630,
"offset_end": 706
}
@@ -222,6 +235,7 @@
]
}
},
"offset_field": 755,
"offset_start": 768,
"offset_end": 848
}
@@ -255,6 +269,7 @@
]
}
},
"offset_field": 897,
"offset_start": 910,
"offset_end": 947
},
@@ -265,6 +280,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 947,
"offset_start": 973,
"offset_end": 992
}
@@ -295,6 +311,7 @@
]
}
},
"offset_field": 1846,
"offset_start": 1859,
"offset_end": 1895
},
@@ -305,6 +322,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1895,
"offset_start": 1921,
"offset_end": 1940
}
@@ -335,6 +353,7 @@
]
}
},
"offset_field": 3435,
"offset_start": 3448,
"offset_end": 3483
},
@@ -345,6 +364,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3483,
"offset_start": 3509,
"offset_end": 3518
},
@@ -355,6 +375,7 @@
"value": {
"Text": "938014623@17052000-0f9b"
},
"offset_field": 3518,
"offset_start": 3529,
"offset_end": 3557
}
@@ -1711,6 +1732,7 @@
]
}
},
"offset_field": 5471,
"offset_start": 5484,
"offset_end": 5520
},
@@ -1721,6 +1743,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5520,
"offset_start": 5546,
"offset_end": 5555
},
@@ -1740,6 +1763,7 @@
]
}
},
"offset_field": 5555,
"offset_start": 5575,
"offset_end": 5616
}
@@ -3069,6 +3093,7 @@
]
}
},
"offset_field": 7443,
"offset_start": 7456,
"offset_end": 7490
},
@@ -3079,6 +3104,7 @@
"value": {
"Text": "base64"
},
"offset_field": 7490,
"offset_start": 7516,
"offset_end": 7525
},
@@ -3098,6 +3124,7 @@
]
}
},
"offset_field": 7525,
"offset_start": 7545,
"offset_end": 7584
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "J�rgen Schm�rgen",
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 11,
"second": 50,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "base64"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 352
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 352,
"offset_start": 363,
"offset_end": 376
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 376,
"offset_start": 394,
"offset_end": 403
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 403,
"offset_start": 412,
"offset_end": 465
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 465,
"offset_start": 476,
"offset_end": 485
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 485,
"offset_start": 495,
"offset_end": 543
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n"
},
"offset_header": 0,
"offset_body": 545,
"offset_end": 1571
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
@@ -111,6 +118,7 @@
"value": {
"Text": "base64"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 352
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 352,
"offset_start": 363,
"offset_end": 376
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 376,
"offset_start": 394,
"offset_end": 403
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 403,
"offset_start": 412,
"offset_end": 465
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 465,
"offset_start": 476,
"offset_end": 485
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 485,
"offset_start": 495,
"offset_end": 543
}
File diff suppressed because it is too large Load Diff
+21 -2
View File
@@ -20,6 +20,7 @@
"value": {
"Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -28,8 +29,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -38,8 +40,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -60,6 +63,7 @@
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
@@ -73,6 +77,7 @@
"address": "jschmuergen@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 295
},
@@ -86,6 +91,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 295,
"offset_start": 300,
"offset_end": 337
},
@@ -96,6 +102,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 337,
"offset_start": 345,
"offset_end": 390
},
@@ -106,6 +113,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 390,
"offset_start": 403,
"offset_end": 409
},
@@ -125,6 +133,7 @@
]
}
},
"offset_field": 409,
"offset_start": 422,
"offset_end": 489
}
@@ -160,6 +169,7 @@
]
}
},
"offset_field": 529,
"offset_start": 542,
"offset_end": 577
},
@@ -170,6 +180,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 577,
"offset_start": 603,
"offset_end": 622
}
@@ -200,6 +211,7 @@
]
}
},
"offset_field": 1473,
"offset_start": 1486,
"offset_end": 1519
},
@@ -210,6 +222,7 @@
"value": {
"Text": "base64"
},
"offset_field": 1519,
"offset_start": 1545,
"offset_end": 1554
},
@@ -229,6 +242,7 @@
]
}
},
"offset_field": 1554,
"offset_start": 1574,
"offset_end": 1612
}
@@ -1585,6 +1599,7 @@
]
}
},
"offset_field": 3468,
"offset_start": 3481,
"offset_end": 3514
},
@@ -1604,6 +1619,7 @@
]
}
},
"offset_field": 3514,
"offset_start": 3534,
"offset_end": 3578
}
@@ -1634,6 +1650,7 @@
]
}
},
"offset_field": 4424,
"offset_start": 4437,
"offset_end": 4472
},
@@ -1644,6 +1661,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 4472,
"offset_start": 4498,
"offset_end": 4517
},
@@ -1663,6 +1681,7 @@
]
}
},
"offset_field": 4517,
"offset_start": 4537,
"offset_end": 4582
}
File diff suppressed because it is too large Load Diff
+23 -3
View File
@@ -19,6 +19,7 @@
"value": {
"Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -27,8 +28,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -37,8 +39,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -47,8 +50,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -69,6 +73,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -82,6 +87,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 288
},
@@ -95,6 +101,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 288,
"offset_start": 293,
"offset_end": 330
},
@@ -105,6 +112,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 330,
"offset_start": 338,
"offset_end": 383
},
@@ -115,6 +123,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 383,
"offset_start": 396,
"offset_end": 402
},
@@ -138,6 +147,7 @@
]
}
},
"offset_field": 402,
"offset_start": 415,
"offset_end": 508
}
@@ -172,6 +182,7 @@
]
}
},
"offset_field": 552,
"offset_start": 565,
"offset_end": 599
},
@@ -182,6 +193,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 599,
"offset_start": 625,
"offset_end": 644
}
@@ -212,6 +224,7 @@
]
}
},
"offset_field": 1929,
"offset_start": 1942,
"offset_end": 1975
},
@@ -222,6 +235,7 @@
"value": {
"Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2"
},
"offset_field": 1975,
"offset_start": 1986,
"offset_end": 2041
},
@@ -232,6 +246,7 @@
"value": {
"Text": "base64"
},
"offset_field": 2041,
"offset_start": 2067,
"offset_end": 2076
},
@@ -251,6 +266,7 @@
]
}
},
"offset_field": 2076,
"offset_start": 2096,
"offset_end": 2130
}
@@ -1607,6 +1623,7 @@
]
}
},
"offset_field": 3990,
"offset_start": 4003,
"offset_end": 4036
},
@@ -1617,6 +1634,7 @@
"value": {
"Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3"
},
"offset_field": 4036,
"offset_start": 4047,
"offset_end": 4102
},
@@ -1627,6 +1645,7 @@
"value": {
"Text": "base64"
},
"offset_field": 4102,
"offset_start": 4128,
"offset_end": 4137
},
@@ -1646,6 +1665,7 @@
]
}
},
"offset_field": 4137,
"offset_start": 4157,
"offset_end": 4191
}
File diff suppressed because it is too large Load Diff
+30 -3
View File
@@ -21,6 +21,7 @@
"value": {
"Text": "4.2.0.58.20000519003809.00a85140@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -29,8 +30,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -39,8 +41,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -49,8 +52,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 2 (High)\r\n"
"Text": "2 (High)"
},
"offset_field": 170,
"offset_start": 181,
"offset_end": 192
},
@@ -71,6 +75,7 @@
"tz_minute": 0
}
},
"offset_field": 192,
"offset_start": 197,
"offset_end": 231
},
@@ -84,6 +89,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 231,
"offset_start": 234,
"offset_end": 288
},
@@ -97,6 +103,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 288,
"offset_start": 293,
"offset_end": 330
},
@@ -107,6 +114,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 330,
"offset_start": 338,
"offset_end": 383
},
@@ -117,6 +125,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 383,
"offset_start": 396,
"offset_end": 402
},
@@ -136,6 +145,7 @@
]
}
},
"offset_field": 402,
"offset_start": 415,
"offset_end": 482
}
@@ -174,6 +184,7 @@
]
}
},
"offset_field": 522,
"offset_start": 535,
"offset_end": 628
}
@@ -208,6 +219,7 @@
]
}
},
"offset_field": 672,
"offset_start": 685,
"offset_end": 719
},
@@ -218,6 +230,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 719,
"offset_start": 745,
"offset_end": 764
}
@@ -248,6 +261,7 @@
]
}
},
"offset_field": 2040,
"offset_start": 2053,
"offset_end": 2086
},
@@ -258,6 +272,7 @@
"value": {
"Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2"
},
"offset_field": 2086,
"offset_start": 2097,
"offset_end": 2152
},
@@ -268,6 +283,7 @@
"value": {
"Text": "base64"
},
"offset_field": 2152,
"offset_start": 2178,
"offset_end": 2187
},
@@ -287,6 +303,7 @@
]
}
},
"offset_field": 2187,
"offset_start": 2207,
"offset_end": 2241
}
@@ -1643,6 +1660,7 @@
]
}
},
"offset_field": 4101,
"offset_start": 4114,
"offset_end": 4147
},
@@ -1653,6 +1671,7 @@
"value": {
"Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3"
},
"offset_field": 4147,
"offset_start": 4158,
"offset_end": 4213
},
@@ -1663,6 +1682,7 @@
"value": {
"Text": "base64"
},
"offset_field": 4213,
"offset_start": 4239,
"offset_end": 4248
},
@@ -1682,6 +1702,7 @@
]
}
},
"offset_field": 4248,
"offset_start": 4268,
"offset_end": 4302
}
@@ -3166,6 +3187,7 @@
]
}
},
"offset_field": 6380,
"offset_start": 6393,
"offset_end": 6426
},
@@ -3176,6 +3198,7 @@
"value": {
"Text": "base64"
},
"offset_field": 6426,
"offset_start": 6452,
"offset_end": 6461
},
@@ -3195,6 +3218,7 @@
]
}
},
"offset_field": 6461,
"offset_start": 6481,
"offset_end": 6519
}
@@ -4551,6 +4575,7 @@
]
}
},
"offset_field": 8375,
"offset_start": 8388,
"offset_end": 8422
},
@@ -4561,6 +4586,7 @@
"value": {
"Text": "base64"
},
"offset_field": 8422,
"offset_start": 8448,
"offset_end": 8457
},
@@ -4580,6 +4606,7 @@
]
}
},
"offset_field": 8457,
"offset_start": 8477,
"offset_end": 8516
}
+316
View File
@@ -0,0 +1,316 @@
{
"html_body": [
1
],
"text_body": [
1
],
"attachments": [
2,
3
],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
{
"name": {
"Other": "X-Sender"
},
"value": {
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 19,
"hour": 0,
"minute": 59,
"second": 31,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Heinz Müller",
"address": "mueller@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 266
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 266,
"offset_start": 271,
"offset_end": 308
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 308,
"offset_start": 316,
"offset_end": 361
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 361,
"offset_start": 374,
"offset_end": 380
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "mixed",
"attributes": [
[
"boundary",
"=====================_716740438==_"
]
]
}
},
"offset_field": 380,
"offset_start": 393,
"offset_end": 460
}
],
"is_encoding_problem": false,
"body": {
"Multipart": [
1,
2,
3
]
},
"offset_header": 0,
"offset_body": 462,
"offset_end": 3743
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 500,
"offset_start": 513,
"offset_end": 548
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 548,
"offset_start": 574,
"offset_end": 593
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
},
"offset_header": 500,
"offset_body": 595,
"offset_end": 1404
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"name",
"HasenundFr�sche.txt"
],
[
"x-mac-type",
"54455854"
],
[
"x-mac-creator",
"74747874"
]
]
}
},
"offset_field": 1444,
"offset_start": 1457,
"offset_end": 1549
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "x-uuencode"
},
"offset_field": 1549,
"offset_start": 1575,
"offset_end": 1588
},
{
"name": {
"Rfc": "content_disposition"
},
"value": {
"ContentType": {
"c_type": "attachment",
"c_subtype": null,
"attributes": [
[
"filename",
"HasenundFr�sche.txt"
]
]
}
},
"offset_field": 1588,
"offset_start": 1608,
"offset_end": 1653
}
],
"is_encoding_problem": false,
"body": {
"Text": "\r\nbegin 600 HasenundFr�sche.txt\r\nM1&EE($AA<V5N('5N9\"!D:64@1G+V<V-H90T*#0I$:64@2&%S96X@:VQA9W1E\r\nM;B!E:6YS=\"#\\8F5R(&EH<F4@;6G?;&EC:&4@3&%G93L@(G=I<B!L96)E;B(L\r\nM('-P<F%C:\"!E:6X@4F5D;F5R+\"`B:6X@<W1E=&5R($9U<F-H=\"!V;W(@365N\r\nM<V-H96X@=6YD(%1I97)E;BP@96EN92!\"975T92!D97(@2'5N9&4L(&1E<B!!\r\nM9&QE<BP@:F$@9F%S=\"!A;&QE<B!2875B=&EE<F4A(%5N<V5R92!S=&5T92!!\r\nM;F=S=\"!I<W0@Y')G97(@86QS(&1E<B!4;V0@<V5L8G-T+B!!=68L(&QAWW0@\r\nM=6YS(&5I;B!F_'(@86QL96UA;\"!S=&5R8F5N+B(@#0H-\"DEN(&5I;F5M(&YA\r\nM:&5N(%1E:6-H('=O;&QT96X@<VEE('-I8V@@;G5N(&5R<^1U9F5N.R!S:64@\r\nM96EL=&5N(&EH;2!Z=3L@86QL96EN(&1A<R!A==]E<F]R9&5N=&QI8VAE($=E\r\nM=/9S92!U;F0@:6AR92!W=6YD97)B87)E($=E<W1A;'0@97)S8VAR96-K=&4@\r\nM96EN92!-96YG92!&<O9S8VAE+\"!D:64@86T@569E<B!S8=]E;BP@<V\\@<V5H\r\nM<BP@9&'?('-I92!A=69S('-C:&YE;&QS=&4@=6YT97)T875C:'1E;BX@#0H-\r\nM\"B)(86QT(BP@<FEE9B!N=6X@96)E;B!D:65S97(@4W!R96-H97(L(\")W:7(@\r\nM=V]L;&5N(&1A<R!%<G/D=69E;B!N;V-H(&5I;B!W96YI9R!A=69S8VAI96)E\r\nM;BP@9&5N;B!A=6-H('5N<R!F_')C:'1E;BP@=VEE(&EH<B!S96AT+\"!E:6YI\r\nM9V4@5&EE<F4L('=E;&-H92!A;'-O('=O:&P@;F]C:\"!U;F=L_&-K;&EC:&5R\r\n;('-E:6X@;?QS<V5N(&%L<R!W:7(N(B`-\"@T*\r\n`\r\nend\r\n"
},
"offset_header": 1444,
"offset_body": 1655,
"offset_end": 2743
},
{
"headers": [
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"us-ascii"
]
]
}
},
"offset_field": 2783,
"offset_start": 2796,
"offset_end": 2829
},
{
"name": {
"Rfc": "content_disposition"
},
"value": {
"ContentType": {
"c_type": "attachment",
"c_subtype": null,
"attributes": [
[
"filename",
"farmerandstork.txt"
]
]
}
},
"offset_field": 2829,
"offset_start": 2849,
"offset_end": 2893
}
],
"is_encoding_problem": false,
"body": {
"Text": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n"
},
"offset_header": 2783,
"offset_body": 2895,
"offset_end": 3699
}
]
}
+18 -2
View File
@@ -19,6 +19,7 @@
"value": {
"Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 64
},
@@ -27,8 +28,9 @@
"Other": "X-Sender"
},
"value": {
"Text": " dwsauder@pop.example.com (Unverified)\r\n"
"Text": "dwsauder@pop.example.com (Unverified)"
},
"offset_field": 64,
"offset_start": 73,
"offset_end": 113
},
@@ -37,8 +39,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " QUALCOMM Windows Eudora Pro Version 4.2.0.58 \r\n"
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
},
"offset_field": 113,
"offset_start": 122,
"offset_end": 170
},
@@ -59,6 +62,7 @@
"tz_minute": 0
}
},
"offset_field": 170,
"offset_start": 175,
"offset_end": 209
},
@@ -72,6 +76,7 @@
"address": "mueller@example.com"
}
},
"offset_field": 209,
"offset_start": 212,
"offset_end": 266
},
@@ -85,6 +90,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 266,
"offset_start": 271,
"offset_end": 308
},
@@ -95,6 +101,7 @@
"value": {
"Text": "Die Hasen und die Frösche"
},
"offset_field": 308,
"offset_start": 316,
"offset_end": 361
},
@@ -105,6 +112,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 361,
"offset_start": 374,
"offset_end": 380
},
@@ -124,6 +132,7 @@
]
}
},
"offset_field": 380,
"offset_start": 393,
"offset_end": 460
}
@@ -158,6 +167,7 @@
]
}
},
"offset_field": 500,
"offset_start": 513,
"offset_end": 548
},
@@ -168,6 +178,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 548,
"offset_start": 574,
"offset_end": 593
}
@@ -206,6 +217,7 @@
]
}
},
"offset_field": 1444,
"offset_start": 1457,
"offset_end": 1549
},
@@ -216,6 +228,7 @@
"value": {
"Text": "x-uuencode"
},
"offset_field": 1549,
"offset_start": 1575,
"offset_end": 1588
},
@@ -235,6 +248,7 @@
]
}
},
"offset_field": 1588,
"offset_start": 1608,
"offset_end": 1653
}
@@ -265,6 +279,7 @@
]
}
},
"offset_field": 2783,
"offset_start": 2796,
"offset_end": 2829
},
@@ -284,6 +299,7 @@
]
}
},
"offset_field": 2829,
"offset_start": 2849,
"offset_end": 2893
}
+190
View File
@@ -0,0 +1,190 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "J�rgen Schm�rgen",
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 19,
"minute": 10,
"second": 31,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGMEKBCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"iso-8859-1"
]
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "quoted-printable"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 362
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "3 (Normal)"
},
"offset_field": 362,
"offset_start": 373,
"offset_end": 386
},
{
"name": {
"Other": "X-MSMail-Priority"
},
"value": {
"Text": "Normal"
},
"offset_field": 386,
"offset_start": 404,
"offset_end": 413
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 413,
"offset_start": 422,
"offset_end": 475
},
{
"name": {
"Other": "Importance"
},
"value": {
"Text": "Normal"
},
"offset_field": 475,
"offset_start": 486,
"offset_end": 495
},
{
"name": {
"Other": "X-MimeOLE"
},
"value": {
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 495,
"offset_start": 505,
"offset_end": 553
}
],
"is_encoding_problem": false,
"body": {
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
},
"offset_header": 0,
"offset_body": 555,
"offset_end": 1364
}
]
}
+18 -5
View File
@@ -19,6 +19,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -32,6 +33,7 @@
"address": "schmuergen@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 89
},
@@ -42,6 +44,7 @@
"value": {
"Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)"
},
"offset_field": 89,
"offset_start": 97,
"offset_end": 148
},
@@ -62,6 +65,7 @@
"tz_minute": 0
}
},
"offset_field": 148,
"offset_start": 153,
"offset_end": 187
},
@@ -72,6 +76,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGMEKBCHAA.doug@example.com"
},
"offset_field": 187,
"offset_start": 198,
"offset_end": 248
},
@@ -82,6 +87,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 248,
"offset_start": 261,
"offset_end": 267
},
@@ -101,6 +107,7 @@
]
}
},
"offset_field": 267,
"offset_start": 280,
"offset_end": 317
},
@@ -111,6 +118,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 317,
"offset_start": 343,
"offset_end": 362
},
@@ -119,8 +127,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 362,
"offset_start": 373,
"offset_end": 386
},
@@ -129,8 +138,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 386,
"offset_start": 404,
"offset_end": 413
},
@@ -139,8 +149,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 413,
"offset_start": 422,
"offset_end": 475
},
@@ -149,8 +160,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 475,
"offset_start": 486,
"offset_end": 495
},
@@ -159,8 +171,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 495,
"offset_start": 505,
"offset_end": 553
}
File diff suppressed because it is too large Load Diff
+28 -5
View File
@@ -22,6 +22,7 @@
"address": "doug@example.com"
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 40
},
@@ -35,6 +36,7 @@
"address": "jblow@example.com"
}
},
"offset_field": 40,
"offset_start": 43,
"offset_end": 76
},
@@ -45,6 +47,7 @@
"value": {
"Text": "Test message from Microsoft Outlook 00"
},
"offset_field": 76,
"offset_start": 84,
"offset_end": 125
},
@@ -65,6 +68,7 @@
"tz_minute": 0
}
},
"offset_field": 125,
"offset_start": 130,
"offset_end": 164
},
@@ -75,6 +79,7 @@
"value": {
"Text": "NDBBIAKOPKHFGPLCODIGKEKFCHAA.doug@example.com"
},
"offset_field": 164,
"offset_start": 175,
"offset_end": 225
},
@@ -85,6 +90,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 225,
"offset_start": 238,
"offset_end": 244
},
@@ -104,6 +110,7 @@
]
}
},
"offset_field": 244,
"offset_start": 257,
"offset_end": 333
},
@@ -112,8 +119,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 3 (Normal)\r\n"
"Text": "3 (Normal)"
},
"offset_field": 333,
"offset_start": 344,
"offset_end": 357
},
@@ -122,8 +130,9 @@
"Other": "X-MSMail-Priority"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 357,
"offset_start": 375,
"offset_end": 384
},
@@ -132,8 +141,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)\r\n"
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
},
"offset_field": 384,
"offset_start": 393,
"offset_end": 446
},
@@ -142,8 +152,9 @@
"Other": "Importance"
},
"value": {
"Text": " Normal\r\n"
"Text": "Normal"
},
"offset_field": 446,
"offset_start": 457,
"offset_end": 466
},
@@ -152,8 +163,9 @@
"Other": "X-MimeOLE"
},
"value": {
"Text": " Produced By Microsoft MimeOLE V5.00.2314.1300\r\n"
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
},
"offset_field": 466,
"offset_start": 476,
"offset_end": 524
}
@@ -188,6 +200,7 @@
]
}
},
"offset_field": 619,
"offset_start": 632,
"offset_end": 712
}
@@ -221,6 +234,7 @@
]
}
},
"offset_field": 761,
"offset_start": 774,
"offset_end": 811
},
@@ -231,6 +245,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 811,
"offset_start": 837,
"offset_end": 856
}
@@ -261,6 +276,7 @@
]
}
},
"offset_field": 1714,
"offset_start": 1727,
"offset_end": 1763
},
@@ -271,6 +287,7 @@
"value": {
"Text": "quoted-printable"
},
"offset_field": 1763,
"offset_start": 1789,
"offset_end": 1808
}
@@ -301,6 +318,7 @@
]
}
},
"offset_field": 3482,
"offset_start": 3495,
"offset_end": 3530
},
@@ -311,6 +329,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3530,
"offset_start": 3556,
"offset_end": 3565
},
@@ -321,6 +340,7 @@
"value": {
"Text": "823504223@17052000-0f8d"
},
"offset_field": 3565,
"offset_start": 3576,
"offset_end": 3604
}
@@ -1677,6 +1697,7 @@
]
}
},
"offset_field": 5469,
"offset_start": 5482,
"offset_end": 5516
},
@@ -1687,6 +1708,7 @@
"value": {
"Text": "base64"
},
"offset_field": 5516,
"offset_start": 5542,
"offset_end": 5551
},
@@ -1697,6 +1719,7 @@
"value": {
"Text": "823504223@17052000-0f94"
},
"offset_field": 5551,
"offset_start": 5562,
"offset_end": 5590
}
+168
View File
@@ -0,0 +1,168 @@
{
"html_body": [
0
],
"text_body": [
0
],
"attachments": [],
"parts": [
{
"headers": [
{
"name": {
"Rfc": "message_id"
},
"value": {
"Text": "392362D8.B650789F@example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 45
},
{
"name": {
"Rfc": "date"
},
"value": {
"DateTime": {
"year": 2000,
"month": 5,
"day": 17,
"hour": 23,
"minute": 26,
"second": 16,
"tz_before_gmt": true,
"tz_hour": 4,
"tz_minute": 0
}
},
"offset_field": 45,
"offset_start": 50,
"offset_end": 84
},
{
"name": {
"Rfc": "from"
},
"value": {
"Address": {
"name": "Doug Sauder",
"address": "dwsauder@example.com"
}
},
"offset_field": 84,
"offset_start": 89,
"offset_end": 126
},
{
"name": {
"Other": "X-Mailer"
},
"value": {
"Text": "Mozilla 4.7 [en] (WinNT; I)"
},
"offset_field": 126,
"offset_start": 135,
"offset_end": 165
},
{
"name": {
"Other": "X-Accept-Language"
},
"value": {
"Text": "en"
},
"offset_field": 165,
"offset_start": 183,
"offset_end": 188
},
{
"name": {
"Rfc": "mime_version"
},
"value": {
"Text": "1.0"
},
"offset_field": 188,
"offset_start": 201,
"offset_end": 207
},
{
"name": {
"Rfc": "to"
},
"value": {
"Address": {
"name": "Joe Blow",
"address": "blow@example.com"
}
},
"offset_field": 207,
"offset_start": 210,
"offset_end": 240
},
{
"name": {
"Rfc": "subject"
},
"value": {
"Text": "Test message from Netscape Communicator 4.7"
},
"offset_field": 240,
"offset_start": 248,
"offset_end": 294
},
{
"name": {
"Other": "X-Priority"
},
"value": {
"Text": "1 (Highest)"
},
"offset_field": 294,
"offset_start": 305,
"offset_end": 319
},
{
"name": {
"Rfc": "content_type"
},
"value": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": [
[
"charset",
"us-ascii"
]
]
}
},
"offset_field": 319,
"offset_start": 332,
"offset_end": 363
},
{
"name": {
"Rfc": "content_transfer_encoding"
},
"value": {
"Text": "7bit"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 396
}
],
"is_encoding_problem": false,
"body": {
"Text": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r\n"
},
"offset_header": 0,
"offset_body": 398,
"offset_end": 1167
}
]
}
+14 -3
View File
@@ -16,6 +16,7 @@
"value": {
"Text": "392362D8.B650789F@example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 45
},
@@ -36,6 +37,7 @@
"tz_minute": 0
}
},
"offset_field": 45,
"offset_start": 50,
"offset_end": 84
},
@@ -49,6 +51,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 84,
"offset_start": 89,
"offset_end": 126
},
@@ -57,8 +60,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Mozilla 4.7 [en] (WinNT; I)\r\n"
"Text": "Mozilla 4.7 [en] (WinNT; I)"
},
"offset_field": 126,
"offset_start": 135,
"offset_end": 165
},
@@ -67,8 +71,9 @@
"Other": "X-Accept-Language"
},
"value": {
"Text": " en\r\n"
"Text": "en"
},
"offset_field": 165,
"offset_start": 183,
"offset_end": 188
},
@@ -79,6 +84,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 188,
"offset_start": 201,
"offset_end": 207
},
@@ -92,6 +98,7 @@
"address": "blow@example.com"
}
},
"offset_field": 207,
"offset_start": 210,
"offset_end": 240
},
@@ -102,6 +109,7 @@
"value": {
"Text": "Test message from Netscape Communicator 4.7"
},
"offset_field": 240,
"offset_start": 248,
"offset_end": 294
},
@@ -110,8 +118,9 @@
"Other": "X-Priority"
},
"value": {
"Text": " 1 (Highest)\r\n"
"Text": "1 (Highest)"
},
"offset_field": 294,
"offset_start": 305,
"offset_end": 319
},
@@ -131,6 +140,7 @@
]
}
},
"offset_field": 319,
"offset_start": 332,
"offset_end": 363
},
@@ -141,6 +151,7 @@
"value": {
"Text": "7bit"
},
"offset_field": 363,
"offset_start": 389,
"offset_end": 396
}
File diff suppressed because it is too large Load Diff
+22 -2
View File
@@ -24,6 +24,7 @@
"value": {
"Text": "3923635B.85C58444@example.com"
},
"offset_field": 0,
"offset_start": 11,
"offset_end": 45
},
@@ -44,6 +45,7 @@
"tz_minute": 0
}
},
"offset_field": 45,
"offset_start": 50,
"offset_end": 84
},
@@ -57,6 +59,7 @@
"address": "dwsauder@example.com"
}
},
"offset_field": 84,
"offset_start": 89,
"offset_end": 126
},
@@ -65,8 +68,9 @@
"Other": "X-Mailer"
},
"value": {
"Text": " Mozilla 4.7 [en] (WinNT; I)\r\n"
"Text": "Mozilla 4.7 [en] (WinNT; I)"
},
"offset_field": 126,
"offset_start": 135,
"offset_end": 165
},
@@ -75,8 +79,9 @@
"Other": "X-Accept-Language"
},
"value": {
"Text": " en\r\n"
"Text": "en"
},
"offset_field": 165,
"offset_start": 183,
"offset_end": 188
},
@@ -87,6 +92,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 188,
"offset_start": 201,
"offset_end": 207
},
@@ -100,6 +106,7 @@
"address": "blow@example.com"
}
},
"offset_field": 207,
"offset_start": 210,
"offset_end": 240
},
@@ -110,6 +117,7 @@
"value": {
"Text": "Test message from Netscape Communicator 4.7"
},
"offset_field": 240,
"offset_start": 248,
"offset_end": 294
},
@@ -129,6 +137,7 @@
]
}
},
"offset_field": 294,
"offset_start": 307,
"offset_end": 376
}
@@ -164,6 +173,7 @@
]
}
},
"offset_field": 464,
"offset_start": 477,
"offset_end": 508
},
@@ -174,6 +184,7 @@
"value": {
"Text": "7bit"
},
"offset_field": 508,
"offset_start": 534,
"offset_end": 541
}
@@ -204,6 +215,7 @@
]
}
},
"offset_field": 1352,
"offset_start": 1365,
"offset_end": 1400
},
@@ -214,6 +226,7 @@
"value": {
"Text": "base64"
},
"offset_field": 1400,
"offset_start": 1426,
"offset_end": 1435
},
@@ -233,6 +246,7 @@
]
}
},
"offset_field": 1435,
"offset_start": 1455,
"offset_end": 1491
}
@@ -1589,6 +1603,7 @@
]
}
},
"offset_field": 3351,
"offset_start": 3364,
"offset_end": 3400
},
@@ -1599,6 +1614,7 @@
"value": {
"Text": "base64"
},
"offset_field": 3400,
"offset_start": 3426,
"offset_end": 3435
},
@@ -1618,6 +1634,7 @@
]
}
},
"offset_field": 3435,
"offset_start": 3455,
"offset_end": 3492
}
@@ -2951,6 +2968,7 @@
]
}
},
"offset_field": 5316,
"offset_start": 5329,
"offset_end": 5389
},
@@ -2961,6 +2979,7 @@
"value": {
"Text": "7bit"
},
"offset_field": 5389,
"offset_start": 5415,
"offset_end": 5422
},
@@ -2980,6 +2999,7 @@
]
}
},
"offset_field": 5422,
"offset_start": 5442,
"offset_end": 5484
}
File diff suppressed because it is too large Load Diff
+18
View File
@@ -29,6 +29,7 @@
"tz_minute": 0
}
},
"offset_field": 0,
"offset_start": 5,
"offset_end": 45
},
@@ -42,6 +43,7 @@
"address": "doug@penguin.example.com"
}
},
"offset_field": 45,
"offset_start": 50,
"offset_end": 91
},
@@ -55,6 +57,7 @@
"address": "blow@example.com"
}
},
"offset_field": 91,
"offset_start": 94,
"offset_end": 124
},
@@ -65,6 +68,7 @@
"value": {
"Text": "Test message from PINE"
},
"offset_field": 124,
"offset_start": 132,
"offset_end": 157
},
@@ -75,6 +79,7 @@
"value": {
"Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com"
},
"offset_field": 157,
"offset_start": 168,
"offset_end": 232
},
@@ -85,6 +90,7 @@
"value": {
"Text": "1.0"
},
"offset_field": 232,
"offset_start": 245,
"offset_end": 251
},
@@ -104,6 +110,7 @@
]
}
},
"offset_field": 251,
"offset_start": 264,
"offset_end": 332
}
@@ -138,6 +145,7 @@
]
}
},
"offset_field": 595,
"offset_start": 608,
"offset_end": 639
}
@@ -168,6 +176,7 @@
]
}
},
"offset_field": 725,
"offset_start": 738,
"offset_end": 785
},
@@ -178,6 +187,7 @@
"value": {
"Text": "BASE64"
},
"offset_field": 785,
"offset_start": 811,
"offset_end": 820
},
@@ -188,6 +198,7 @@
"value": {
"Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com"
},
"offset_field": 820,
"offset_start": 831,
"offset_end": 888
},
@@ -198,6 +209,7 @@
"value": {
"Text": "A PNG graphic file"
},
"offset_field": 888,
"offset_start": 908,
"offset_end": 929
},
@@ -217,6 +229,7 @@
]
}
},
"offset_field": 929,
"offset_start": 949,
"offset_end": 986
}
@@ -1701,6 +1714,7 @@
]
}
},
"offset_field": 3035,
"offset_start": 3048,
"offset_end": 3096
},
@@ -1711,6 +1725,7 @@
"value": {
"Text": "BASE64"
},
"offset_field": 3096,
"offset_start": 3122,
"offset_end": 3131
},
@@ -1721,6 +1736,7 @@
"value": {
"Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com"
},
"offset_field": 3131,
"offset_start": 3142,
"offset_end": 3199
},
@@ -1731,6 +1747,7 @@
"value": {
"Text": "A PNG graphic file"
},
"offset_field": 3199,
"offset_start": 3219,
"offset_end": 3240
},
@@ -1750,6 +1767,7 @@
]
}
},
"offset_field": 3240,
"offset_start": 3260,
"offset_end": 3298
}

Some files were not shown because too many files have changed in this diff Show More