mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-11-29 16:01:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77fe8cd0d1 | ||
|
|
b4478f74e2 | ||
|
|
da1e6180db | ||
|
|
cf8de086c7 | ||
|
|
c7ae90b3bf | ||
|
|
bb0e42e13b | ||
|
|
8ff26db481 | ||
|
|
f4424eeefc | ||
|
|
c542f8a0db | ||
|
|
26bca49aac | ||
|
|
58b1bc8966 | ||
|
|
fbd53cb094 | ||
|
|
be32ba64a9 | ||
|
|
7b08027955 | ||
|
|
b653d6fa3d | ||
|
|
1bf8860da8 | ||
|
|
6fcc57a3d9 | ||
|
|
ef19d20f9c | ||
|
|
b5af895140 | ||
|
|
7c4db43aca | ||
|
|
f544f729be | ||
|
|
d9682c2725 | ||
|
|
a1497a95b9 | ||
|
|
4390417247 | ||
|
|
3f2200a718 | ||
|
|
f4b6c946fd | ||
|
|
c886cab1a2 | ||
|
|
c9b21208db | ||
|
|
de4aecf9f1 | ||
|
|
9794de57c4 | ||
|
|
b416b0683a | ||
|
|
f26042b8e6 | ||
|
|
c5ce06c586 | ||
|
|
f16aca7ee0 | ||
|
|
d4f45b7e34 | ||
|
|
ae62000a98 | ||
|
|
f080b911df | ||
|
|
1e868fd683 | ||
|
|
09960ef610 | ||
|
|
a9694def15 | ||
|
|
20ecc490f2 | ||
|
|
402ee4c4db | ||
|
|
e922562b1c | ||
|
|
215d5aa9ac | ||
|
|
d230fce62f | ||
|
|
3a7126f64e | ||
|
|
bb0e3366da | ||
|
|
4e49dff9e5 | ||
|
|
6b23f08ee0 | ||
|
|
7f86ea13f9 | ||
|
|
371d0ff12e | ||
|
|
5d4c0538ca | ||
|
|
ff1e2ee70a | ||
|
|
aeb02dcc4d | ||
|
|
db61a0364c | ||
|
|
6dc27dd69b | ||
|
|
b76c9f510c | ||
|
|
c391056b92 | ||
|
|
0064d3443a | ||
|
|
e604f8fcec | ||
|
|
907984861e | ||
|
|
28fe4d3aff | ||
|
|
0891cb0292 | ||
|
|
2805e029ff | ||
|
|
35b4846c7e | ||
|
|
75d9a9e96a | ||
|
|
1e8dfd31cf | ||
|
|
0be5ed4a41 | ||
|
|
62057172d0 | ||
|
|
a963f0caa7 | ||
|
|
e2b33a90f3 | ||
|
|
d157525b1c | ||
|
|
9f1edeed33 | ||
|
|
509fb718f3 | ||
|
|
eab28c0b2d | ||
|
|
2cae61c6d2 | ||
|
|
da4a9d9a47 | ||
|
|
c3b36dd0d6 | ||
|
|
2f380451f5 | ||
|
|
1a2ac1d027 | ||
|
|
beb21b3d03 | ||
|
|
c77f3e2cb4 | ||
|
|
94522f1179 | ||
|
|
6749649e8c | ||
|
|
63a4620407 | ||
|
|
ccdee2332e | ||
|
|
35754eeaa8 | ||
|
|
4a6ec957d2 | ||
|
|
b48e2d711b | ||
|
|
d4c75e74a6 | ||
|
|
f7281e09cf | ||
|
|
46a8db9a54 | ||
|
|
a0448c31e9 |
@@ -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']
|
||||||
@@ -2,3 +2,4 @@
|
|||||||
/test
|
/test
|
||||||
perf.*
|
perf.*
|
||||||
*.svg
|
*.svg
|
||||||
|
Cargo.lock
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
language: rust
|
|
||||||
rust:
|
|
||||||
- stable
|
|
||||||
- beta
|
|
||||||
- nightly
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- rust: nightly
|
|
||||||
@@ -1,3 +1,81 @@
|
|||||||
|
mail-parser 0.8.2
|
||||||
|
================================
|
||||||
|
- Fix: Parsing address name with \ characters (#41)
|
||||||
|
- Fix: Missing space when folded header begins with RFC2047 word (#43)
|
||||||
|
|
||||||
|
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.
|
||||||
|
- Headers and attributes are now stored in a `Vec` instead of a `HashMap` for a tiny performance enhancement.
|
||||||
|
- Support for Content-Type attributes spanning multiple lines.
|
||||||
|
- Support for malformed Thunderbird messages (#27).
|
||||||
|
- Fixed raw offset range for body parts.
|
||||||
|
|
||||||
|
mail-parser 0.5.0
|
||||||
|
================================
|
||||||
|
- `Message` headers are now stored as a `MessagePart` with index 0.
|
||||||
|
- Improved `MessagePart` API.
|
||||||
|
- Nested base64/quoted-printable encoded message/rfc822 parts are automatically parsed when calling `get_message`.
|
||||||
|
- Better handling of malformed MIME messages.
|
||||||
|
- Added raw offsets to MIME parts.
|
||||||
|
|
||||||
|
mail-parser 0.4.8
|
||||||
|
================================
|
||||||
|
- get_bytes_to_boundary fix (#21)
|
||||||
|
|
||||||
|
mail-parser 0.4.7
|
||||||
|
================================
|
||||||
|
- Retrieving message headers in order (#19)
|
||||||
|
- Added `get_raw_headers` and `get_header` methods.
|
||||||
|
- Added `get_return_address` method to obtain the return address from the Return-Path or From headers.
|
||||||
|
- Support for malformed Return-Path headers.
|
||||||
|
- Support for ks_c_5601 charsets (#20)
|
||||||
|
|
||||||
|
mail-parser 0.4.6
|
||||||
|
================================
|
||||||
|
- DateTime is_valid() fix (#15)
|
||||||
|
|
||||||
|
mail-parser 0.4.5
|
||||||
|
================================
|
||||||
|
- DateTime to UNIX timestamp conversion.
|
||||||
|
- Ord, PartialOrd support for DateTime (#13).
|
||||||
|
- Fixed Message::parse() panic on duplicate Content-Type headers (#14).
|
||||||
|
|
||||||
|
mail-parser 0.4.4
|
||||||
|
================================
|
||||||
|
- Support for multi-line headers.
|
||||||
|
- Text and HTML message body preview.
|
||||||
|
- Improved support for raw headers.
|
||||||
|
|
||||||
|
mail-parser 0.4.3
|
||||||
|
================================
|
||||||
|
- Mbox file parsing support (issue #11) conforming to the [QMail specification](http://qmail.org/qmail-manual-html/man5/mbox.html).
|
||||||
|
- Support for bincode serialize/deserialize.
|
||||||
|
|
||||||
mail-parser 0.4.2
|
mail-parser 0.4.2
|
||||||
================================
|
================================
|
||||||
- Added `Message::get_thread_name()` to obtain the base subject of a message as defined in [RFC 5957 - Internet Message Access Protocol - SORT and THREAD Extensions (Section 2.1)](https://datatracker.ietf.org/doc/html/rfc5256#section-2.1).
|
- Added `Message::get_thread_name()` to obtain the base subject of a message as defined in [RFC 5957 - Internet Message Access Protocol - SORT and THREAD Extensions (Section 2.1)](https://datatracker.ietf.org/doc/html/rfc5256#section-2.1).
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
Copyright (C) 2020-2022, Stalwart Labs, Minter Ltd.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
Generated
-171
@@ -1,171 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 3
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "autocfg"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dtoa"
|
|
||||||
version = "0.4.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding_rs"
|
|
||||||
version = "0.8.28"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.11.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indexmap"
|
|
||||||
version = "1.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"hashbrown",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "0.4.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "linked-hash-map"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mail-parser"
|
|
||||||
version = "0.4.2"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_rs",
|
|
||||||
"serde",
|
|
||||||
"serde_bytes",
|
|
||||||
"serde_json",
|
|
||||||
"serde_yaml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro2"
|
|
||||||
version = "1.0.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
|
|
||||||
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 = "ryu"
|
|
||||||
version = "1.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
|
||||||
|
|
||||||
[[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_bytes"
|
|
||||||
version = "0.11.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[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 = "serde_json"
|
|
||||||
version = "1.0.68"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_yaml"
|
|
||||||
version = "0.8.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af"
|
|
||||||
dependencies = [
|
|
||||||
"dtoa",
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"yaml-rust",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.80"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
|
|
||||||
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"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "yaml-rust"
|
|
||||||
version = "0.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
|
||||||
dependencies = [
|
|
||||||
"linked-hash-map",
|
|
||||||
]
|
|
||||||
+11
-6
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mail-parser"
|
name = "mail-parser"
|
||||||
description = "Fast and robust e-mail parsing library for Rust"
|
description = "Fast and robust e-mail parsing library for Rust"
|
||||||
version = "0.4.2"
|
version = "0.8.2"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = [ "Stalwart Labs <hello@stalw.art>"]
|
authors = [ "Stalwart Labs <hello@stalw.art>"]
|
||||||
license = "Apache-2.0 OR MIT"
|
license = "Apache-2.0 OR MIT"
|
||||||
@@ -10,20 +10,25 @@ homepage = "https://github.com/stalwartlabs/mail-parser"
|
|||||||
keywords = ["email", "mime", "mail", "parser", "e-mail"]
|
keywords = ["email", "mime", "mail", "parser", "e-mail"]
|
||||||
categories = ["email", "parser-implementations"]
|
categories = ["email", "parser-implementations"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
encoding_rs = {version="0.8", optional=true}
|
encoding_rs = { version="0.8", optional=true }
|
||||||
serde = { version = "1.0", features = ["derive"], optional=true}
|
serde = { version = "1.0", features = ["derive"], optional=true }
|
||||||
serde_bytes = { version = "0.11", optional=true}
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
mail-parser = { path = ".", features = ["serde_support", "full_encoding"] }
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
bincode = "1.3.3"
|
||||||
|
chrono = "0.4"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["serde_support", "full_encoding"]
|
default = ["full_encoding"]
|
||||||
full_encoding = ["encoding_rs"]
|
full_encoding = ["encoding_rs"]
|
||||||
serde_support = ["serde", "serde_bytes"]
|
serde_support = ["serde"]
|
||||||
|
ludicrous_mode = []
|
||||||
|
|
||||||
[profile.bench]
|
[profile.bench]
|
||||||
debug = true
|
debug = true
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
[](https://github.com/stalwartlabs/mail-parser/actions/workflows/rust.yml)
|
[](https://github.com/stalwartlabs/mail-parser/actions/workflows/rust.yml)
|
||||||
[](https://docs.rs/mail-parser)
|
[](https://docs.rs/mail-parser)
|
||||||
[](http://www.apache.org/licenses/LICENSE-2.0)
|
[](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
[](https://twitter.com/stalwartlabs)
|
|
||||||
|
|
||||||
_mail-parser_ is an **e-mail parsing library** written in Rust that fully conforms to the Internet Message Format standard (_RFC 5322_), the
|
_mail-parser_ is an **e-mail parsing library** written in Rust that fully conforms to the Internet Message Format standard (_RFC 5322_), the
|
||||||
Multipurpose Internet Mail Extensions (MIME; _RFC 2045 - 2049_) as well as many other [internet messaging RFCs](#conformed-rfcs).
|
Multipurpose Internet Mail Extensions (MIME; _RFC 2045 - 2049_) as well as many other [internet messaging RFCs](#conformed-rfcs).
|
||||||
@@ -80,52 +79,44 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
|
|
||||||
// Parses addresses (including comments), lists and groups
|
// Parses addresses (including comments), lists and groups
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_from(),
|
message.from(),
|
||||||
&HeaderValue::Address(Addr {
|
&HeaderValue::Address(Addr::new(
|
||||||
name: Some("Art Vandelay (Vandelay Industries)".into()),
|
"Art Vandelay (Vandelay Industries)".into(),
|
||||||
address: Some("art@vandelay.com".into())
|
"art@vandelay.com"
|
||||||
})
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_to(),
|
message.to(),
|
||||||
&HeaderValue::GroupList(vec![
|
&HeaderValue::GroupList(vec![
|
||||||
Group {
|
Group::new(
|
||||||
name: Some("Colleagues".into()),
|
"Colleagues",
|
||||||
addresses: vec![Addr {
|
vec![Addr::new("James Smythe".into(), "james@vandelay.com")]
|
||||||
name: Some("James Smythe".into()),
|
),
|
||||||
address: Some("james@vandelay.com".into())
|
Group::new(
|
||||||
}]
|
"Friends",
|
||||||
},
|
vec![
|
||||||
Group {
|
Addr::new(None, "jane@example.com"),
|
||||||
name: Some("Friends".into()),
|
Addr::new("John Smîth".into(), "john@example.com"),
|
||||||
addresses: vec![
|
|
||||||
Addr {
|
|
||||||
name: None,
|
|
||||||
address: Some("jane@example.com".into())
|
|
||||||
},
|
|
||||||
Addr {
|
|
||||||
name: Some("John Smîth".into()),
|
|
||||||
address: Some("john@example.com".into())
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_date().unwrap().to_iso8601(),
|
message.date().unwrap().to_rfc3339(),
|
||||||
"2021-11-20T14:22:01-08:00"
|
"2021-11-20T14:22:01-08:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
// RFC2047 support for encoded text in message readers
|
// RFC2047 support for encoded text in message readers
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_subject().unwrap(),
|
message.subject().unwrap(),
|
||||||
"Why not both importing AND exporting? ☺"
|
"Why not both importing AND exporting? ☺"
|
||||||
);
|
);
|
||||||
|
|
||||||
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
|
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_html_body(0).unwrap(),
|
message.body_html(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"<html><p>I was thinking about quitting the “exporting” to ",
|
"<html><p>I was thinking about quitting the “exporting” to ",
|
||||||
"focus just on the “importing”,</p><p>but then I thought,",
|
"focus just on the “importing”,</p><p>but then I thought,",
|
||||||
@@ -135,7 +126,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
|
|
||||||
// HTML parts are converted to plain text (and viceversa) when missing
|
// HTML parts are converted to plain text (and viceversa) when missing
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_text_body(0).unwrap(),
|
message.body_text(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"I was thinking about quitting the “exporting” to focus just on the",
|
"I was thinking about quitting the “exporting” to focus just on the",
|
||||||
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
||||||
@@ -144,32 +135,33 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
|
|
||||||
// Supports nested messages as well as multipart/digest
|
// Supports nested messages as well as multipart/digest
|
||||||
let nested_message = message
|
let nested_message = message
|
||||||
.get_attachment(0)
|
.attachment(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap_message();
|
.message();
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_subject().unwrap(),
|
nested_message.subject().unwrap(),
|
||||||
"Exporting my book about coffee tables"
|
"Exporting my book about coffee tables"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handles UTF-* as well as many legacy encodings
|
// Handles UTF-* as well as many legacy encodings
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_text_body(0).unwrap(),
|
nested_message.body_text(0).unwrap(),
|
||||||
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_html_body(0).unwrap(),
|
nested_message.body_html(0).unwrap(),
|
||||||
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
||||||
);
|
);
|
||||||
|
|
||||||
let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary();
|
let nested_attachment = nested_message.attachment(0).unwrap();
|
||||||
|
|
||||||
assert_eq!(nested_attachment.len(), 42);
|
assert_eq!(nested_attachment.len(), 42);
|
||||||
|
|
||||||
// Full RFC2231 support for continuations and character sets
|
// Full RFC2231 support for continuations and character sets
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_attachment.get_attachment_name().unwrap(),
|
nested_attachment.attachment_name().unwrap(),
|
||||||
"Book about ☕ tables.gif"
|
"Book about ☕ tables.gif"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -178,6 +170,8 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
println!("{}", serde_yaml::to_string(&message).unwrap());
|
println!("{}", serde_yaml::to_string(&message).unwrap());
|
||||||
```
|
```
|
||||||
|
|
||||||
|
More examples available under the [examples](examples) directory. Please note that this library does not support building e-mail messages as this functionality is provided separately by the [`mail-builder`](https://crates.io/crates/mail-builder) crate.
|
||||||
|
|
||||||
## Testing, Fuzzing & Benchmarking
|
## Testing, Fuzzing & Benchmarking
|
||||||
|
|
||||||
To run the testsuite:
|
To run the testsuite:
|
||||||
@@ -284,8 +278,4 @@ at your option.
|
|||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
Copyright (C) 2020-2022, Stalwart Labs, Minter Ltd.
|
Copyright (C) 2020-2022, Stalwart Labs Ltd.
|
||||||
|
|
||||||
See [COPYING] for the license.
|
|
||||||
|
|
||||||
[COPYING]: https://github.com/stalwartlabs/mail-parser/blob/main/COPYING
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
|
* file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||||
|
* option. This file may not be copied, modified, or distributed
|
||||||
|
* except according to those terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use mail_parser::mailbox::maildir::FolderIterator;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Iterates a Maildir++ structure printing the results to stdout.
|
||||||
|
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
test_dir.push("tests");
|
||||||
|
test_dir.push("maildir");
|
||||||
|
|
||||||
|
for folder in FolderIterator::new(test_dir, ".".into()).unwrap() {
|
||||||
|
let folder = folder.unwrap();
|
||||||
|
println!("------\nMailbox: {:?}", folder.name().unwrap_or("INBOX"));
|
||||||
|
|
||||||
|
for message in folder {
|
||||||
|
let message = message.unwrap();
|
||||||
|
println!(
|
||||||
|
"Message with internal date {}, flags {:?} and content {:?}.",
|
||||||
|
message.internal_date(),
|
||||||
|
message.flags(),
|
||||||
|
String::from_utf8_lossy(message.contents())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
|
* file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||||
|
* option. This file may not be copied, modified, or distributed
|
||||||
|
* except according to those terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use mail_parser::{mailbox::mbox::MessageIterator, Message};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Reads an MBox mailbox from stdin and prints each message as YAML.
|
||||||
|
for raw_message in MessageIterator::new(std::io::stdin()) {
|
||||||
|
let raw_message = raw_message.unwrap();
|
||||||
|
let message = Message::parse(raw_message.contents()).unwrap();
|
||||||
|
|
||||||
|
println!("{}", serde_yaml::to_string(&message).unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -57,52 +57,44 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
|
|
||||||
// Parses addresses (including comments), lists and groups
|
// Parses addresses (including comments), lists and groups
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_from(),
|
message.from(),
|
||||||
&HeaderValue::Address(Addr {
|
&HeaderValue::Address(Addr::new(
|
||||||
name: Some("Art Vandelay (Vandelay Industries)".into()),
|
"Art Vandelay (Vandelay Industries)".into(),
|
||||||
address: Some("art@vandelay.com".into())
|
"art@vandelay.com"
|
||||||
})
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_to(),
|
message.to(),
|
||||||
&HeaderValue::GroupList(vec![
|
&HeaderValue::GroupList(vec![
|
||||||
Group {
|
Group::new(
|
||||||
name: Some("Colleagues".into()),
|
"Colleagues",
|
||||||
addresses: vec![Addr {
|
vec![Addr::new("James Smythe".into(), "james@vandelay.com")]
|
||||||
name: Some("James Smythe".into()),
|
),
|
||||||
address: Some("james@vandelay.com".into())
|
Group::new(
|
||||||
}]
|
"Friends",
|
||||||
},
|
vec![
|
||||||
Group {
|
Addr::new(None, "jane@example.com"),
|
||||||
name: Some("Friends".into()),
|
Addr::new("John Smîth".into(), "john@example.com"),
|
||||||
addresses: vec![
|
|
||||||
Addr {
|
|
||||||
name: None,
|
|
||||||
address: Some("jane@example.com".into())
|
|
||||||
},
|
|
||||||
Addr {
|
|
||||||
name: Some("John Smîth".into()),
|
|
||||||
address: Some("john@example.com".into())
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_date().unwrap().to_iso8601(),
|
message.date().unwrap().to_rfc3339(),
|
||||||
"2021-11-20T14:22:01-08:00"
|
"2021-11-20T14:22:01-08:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
// RFC2047 support for encoded text in message readers
|
// RFC2047 support for encoded text in message readers
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_subject().unwrap(),
|
message.subject().unwrap(),
|
||||||
"Why not both importing AND exporting? ☺"
|
"Why not both importing AND exporting? ☺"
|
||||||
);
|
);
|
||||||
|
|
||||||
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
|
// HTML and text body parts are returned conforming to RFC8621, Section 4.1.4
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_html_body(0).unwrap(),
|
message.body_html(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"<html><p>I was thinking about quitting the “exporting” to ",
|
"<html><p>I was thinking about quitting the “exporting” to ",
|
||||||
"focus just on the “importing”,</p><p>but then I thought,",
|
"focus just on the “importing”,</p><p>but then I thought,",
|
||||||
@@ -112,7 +104,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
|
|
||||||
// HTML parts are converted to plain text (and viceversa) when missing
|
// HTML parts are converted to plain text (and viceversa) when missing
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_text_body(0).unwrap(),
|
message.body_text(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"I was thinking about quitting the “exporting” to focus just on the",
|
"I was thinking about quitting the “exporting” to focus just on the",
|
||||||
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
||||||
@@ -120,30 +112,30 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Supports nested messages as well as multipart/digest
|
// Supports nested messages as well as multipart/digest
|
||||||
let nested_message = message.get_attachment(0).unwrap().unwrap_message();
|
let nested_message = message.attachment(0).unwrap().message().unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_subject().unwrap(),
|
nested_message.subject().unwrap(),
|
||||||
"Exporting my book about coffee tables"
|
"Exporting my book about coffee tables"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handles UTF-* as well as many legacy encodings
|
// Handles UTF-* as well as many legacy encodings
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_text_body(0).unwrap(),
|
nested_message.body_text(0).unwrap(),
|
||||||
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_html_body(0).unwrap(),
|
nested_message.body_html(0).unwrap(),
|
||||||
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
||||||
);
|
);
|
||||||
|
|
||||||
let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary();
|
let nested_attachment = nested_message.attachment(0).unwrap();
|
||||||
|
|
||||||
assert_eq!(nested_attachment.len(), 42);
|
assert_eq!(nested_attachment.len(), 42);
|
||||||
|
|
||||||
// Full RFC2231 support for continuations and character sets
|
// Full RFC2231 support for continuations and character sets
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_attachment.get_attachment_name().unwrap(),
|
nested_attachment.attachment_name().unwrap(),
|
||||||
"Book about ☕ tables.gif"
|
"Book about ☕ tables.gif"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -59,31 +59,15 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn write_attachments(message: &Message) {
|
fn write_attachments(message: &Message) {
|
||||||
for attachment in message.get_attachments() {
|
for attachment in message.attachments() {
|
||||||
match attachment {
|
if !attachment.is_message() {
|
||||||
MessagePart::Text(text) | MessagePart::Html(text) => write_part(text),
|
std::fs::write(
|
||||||
MessagePart::Binary(blob) | MessagePart::InlineBinary(blob) => write_part(blob),
|
attachment.attachment_name().unwrap_or("Untitled"),
|
||||||
MessagePart::Message(attached_message) => {
|
attachment.contents(),
|
||||||
// Write attachments of nested messages
|
)
|
||||||
match &attached_message.body {
|
.unwrap();
|
||||||
MessageAttachment::Parsed(message) => write_attachments(message.as_ref()),
|
} else {
|
||||||
MessageAttachment::Raw(_) => {
|
write_attachments(attachment.message().unwrap());
|
||||||
write_attachments(&attached_message.parse_raw().unwrap())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write raw message
|
|
||||||
write_part(attached_message);
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_part<'x>(part: &'x impl BodyPart<'x>) {
|
|
||||||
std::fs::write(
|
|
||||||
part.get_attachment_name().unwrap_or("Untitled"),
|
|
||||||
part.get_contents(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
Generated
+1
-67
@@ -42,11 +42,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mail-parser"
|
name = "mail-parser"
|
||||||
version = "0.4.2"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"serde",
|
|
||||||
"serde_bytes",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -62,67 +60,3 @@ name = "once_cell"
|
|||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
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_bytes"
|
|
||||||
version = "0.11.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[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"
|
|
||||||
|
|||||||
@@ -3,141 +3,89 @@ use libfuzzer_sys::fuzz_target;
|
|||||||
|
|
||||||
use mail_parser::{
|
use mail_parser::{
|
||||||
decoders::{
|
decoders::{
|
||||||
base64::decode_base64,
|
base64::base64_decode,
|
||||||
charsets::{
|
charsets::{
|
||||||
map::get_charset_decoder,
|
map::charset_decoder,
|
||||||
single_byte::decoder_iso_8859_1,
|
single_byte::decoder_iso_8859_1,
|
||||||
utf::{decoder_utf16, decoder_utf16_be, decoder_utf16_le, decoder_utf7},
|
utf::{decoder_utf16, decoder_utf16_be, decoder_utf16_le, decoder_utf7},
|
||||||
},
|
},
|
||||||
encoded_word::decode_rfc2047,
|
|
||||||
hex::decode_hex,
|
hex::decode_hex,
|
||||||
html::{add_html_token, html_to_text, text_to_html},
|
html::{add_html_token, html_to_text, text_to_html},
|
||||||
quoted_printable::decode_quoted_printable,
|
quoted_printable::quoted_printable_decode,
|
||||||
},
|
},
|
||||||
parsers::{
|
parsers::{
|
||||||
fields::{
|
fields::thread::{thread_name, trim_trailing_fwd},
|
||||||
address::parse_address,
|
MessageStream,
|
||||||
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::*,
|
|
||||||
},
|
},
|
||||||
Message,
|
Message,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static RFC822_ALPHABET: &[u8] = b"0123456789abcdefghijklm:=- \r\n";
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
// Fuzz every parsing function
|
for data_ in [
|
||||||
for n_fuzz in 1..=24 {
|
std::borrow::Cow::from(data),
|
||||||
let mut stream = MessageStream::new(&data);
|
std::borrow::Cow::from(into_alphabet(data, RFC822_ALPHABET)),
|
||||||
|
] {
|
||||||
|
let data = data_.as_ref();
|
||||||
|
|
||||||
match n_fuzz {
|
// Fuzz every parsing function
|
||||||
1 => {
|
MessageStream::new(data).parse_date();
|
||||||
parse_date(&mut stream);
|
MessageStream::new(data).parse_address();
|
||||||
}
|
MessageStream::new(data).parse_id();
|
||||||
2 => {
|
MessageStream::new(data).parse_comma_separared();
|
||||||
parse_address(&mut stream);
|
MessageStream::new(data).parse_and_ignore();
|
||||||
}
|
MessageStream::new(data).parse_raw();
|
||||||
3 => {
|
MessageStream::new(data).parse_unstructured();
|
||||||
parse_id(&mut stream);
|
MessageStream::new(data).parse_content_type();
|
||||||
}
|
MessageStream::new(data).parse_headers(&mut Vec::new());
|
||||||
4 => {
|
MessageStream::new(data).parse_header_name();
|
||||||
parse_comma_separared(&mut stream);
|
MessageStream::new(data).decode_rfc2047();
|
||||||
}
|
|
||||||
5 => {
|
MessageStream::new(data).seek_next_part(b"\n");
|
||||||
parse_and_ignore(&mut stream);
|
MessageStream::new(data).mime_part(b"\n");
|
||||||
}
|
MessageStream::new(data).seek_part_end(b"\n"[..].into());
|
||||||
6 => {
|
MessageStream::new(data).skip_crlf();
|
||||||
parse_raw(&mut stream);
|
MessageStream::new(data).is_multipart_end();
|
||||||
}
|
|
||||||
7 => {
|
base64_decode(data);
|
||||||
parse_unstructured(&mut stream);
|
MessageStream::new(data).decode_base64_word();
|
||||||
}
|
MessageStream::new(data).decode_base64_mime(b"\n");
|
||||||
8 => {
|
quoted_printable_decode(data);
|
||||||
parse_content_type(&mut stream);
|
MessageStream::new(data).decode_quoted_printable_word();
|
||||||
}
|
MessageStream::new(data).decode_quoted_printable_mime(b"\n");
|
||||||
9 => {
|
|
||||||
parse_header_name(&data);
|
// Fuzz text functions
|
||||||
}
|
let mut html_str = String::with_capacity(data.len());
|
||||||
10 => {
|
let str_data = String::from_utf8_lossy(data);
|
||||||
decode_rfc2047(&mut stream, 0);
|
add_html_token(&mut html_str, str_data.as_ref().as_bytes(), false);
|
||||||
}
|
html_to_text(&str_data);
|
||||||
11 => {
|
text_to_html(&str_data);
|
||||||
seek_next_part(&mut stream, b"\n");
|
thread_name(&str_data);
|
||||||
}
|
trim_trailing_fwd(&str_data);
|
||||||
12 => {
|
|
||||||
get_bytes_to_boundary(&mut stream, 0, b"\n", false);
|
// Fuzz decoding functions
|
||||||
}
|
decode_hex(data);
|
||||||
13 => {
|
charset_decoder(data);
|
||||||
get_bytes_to_boundary(&mut stream, 0, &[], false);
|
|
||||||
}
|
for decoder in &[
|
||||||
14 => {
|
decoder_utf7,
|
||||||
skip_crlf(&mut stream);
|
decoder_utf16_le,
|
||||||
}
|
decoder_utf16_be,
|
||||||
15 => {
|
decoder_utf16,
|
||||||
is_boundary_end(&mut stream, 0);
|
decoder_iso_8859_1,
|
||||||
}
|
] as &[for<'x> fn(&'x [u8]) -> String]
|
||||||
16 => {
|
{
|
||||||
skip_multipart_end(&mut stream);
|
decoder(data);
|
||||||
}
|
|
||||||
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 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()
|
||||||
|
}
|
||||||
|
|||||||
+314
-126
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,185 +9,373 @@
|
|||||||
* except according to those terms.
|
* 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>(
|
#[inline(always)]
|
||||||
stream: &MessageStream<'x>,
|
pub fn base64_decode(bytes: &[u8]) -> Option<Vec<u8>> {
|
||||||
start_pos: usize,
|
base64_decode_stream(bytes.iter(), bytes.len(), u8::MAX)
|
||||||
boundary: &[u8],
|
}
|
||||||
is_word: bool,
|
|
||||||
) -> (usize, DecodeResult) {
|
|
||||||
let mut success = boundary.is_empty();
|
|
||||||
|
|
||||||
|
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 chunk: u32 = 0;
|
||||||
let mut byte_count: u8 = 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() {
|
if val < 0x01ffffff {
|
||||||
bytes_read += 1;
|
byte_count = (byte_count + 1) & 3;
|
||||||
|
|
||||||
if !success {
|
if byte_count == 1 {
|
||||||
if *ch == boundary[match_count] {
|
chunk = val;
|
||||||
match_count += 1;
|
} else {
|
||||||
if match_count == boundary.len() {
|
chunk |= val;
|
||||||
success = true;
|
|
||||||
break;
|
if byte_count == 0 {
|
||||||
} else {
|
#[cfg(feature = "ludicrous_mode")]
|
||||||
continue;
|
unsafe {
|
||||||
}
|
buf.extend_from_slice(chunk.to_le_bytes().get_unchecked(0..3));
|
||||||
} else if match_count > 0 {
|
}
|
||||||
if *ch == boundary[0] {
|
#[cfg(not(feature = "ludicrous_mode"))]
|
||||||
match_count = 1;
|
buf.extend_from_slice(&chunk.to_le_bytes()[0..3]);
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
match_count = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
match ch {
|
||||||
let val = BASE64_MAP[byte_count as usize][*ch as usize];
|
b'=' => match byte_count {
|
||||||
|
|
||||||
if val >= 0x01ffffff {
|
|
||||||
if *ch == b'=' {
|
|
||||||
match byte_count {
|
|
||||||
1 | 2 => {
|
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]);
|
buf.push(chunk.to_le_bytes()[0]);
|
||||||
|
|
||||||
byte_count = 0;
|
byte_count = 0;
|
||||||
}
|
}
|
||||||
3 => {
|
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]);
|
buf.extend_from_slice(&chunk.to_le_bytes()[0..2]);
|
||||||
byte_count = 0;
|
byte_count = 0;
|
||||||
}
|
}
|
||||||
0 => (),
|
0 => (),
|
||||||
_ => {
|
_ => {
|
||||||
success = false;
|
return None;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
} else if !ch.is_ascii_whitespace() || is_word {
|
b' ' | b'\t' | b'\r' | b'\n' => (),
|
||||||
success = false;
|
_ => return if ch == stop_char { buf.into() } else { None },
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
buf.into()
|
||||||
if success { bytes_read } else { 0 },
|
}
|
||||||
if !buf.is_empty() {
|
|
||||||
buf.shrink_to_fit();
|
impl<'x> MessageStream<'x> {
|
||||||
DecodeResult::Owned(buf)
|
pub fn decode_base64_mime(&mut self, boundary: &[u8]) -> (usize, Cow<'x, [u8]>) {
|
||||||
} else {
|
let mut chunk: u32 = 0;
|
||||||
DecodeResult::Empty
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::parsers::MessageStream;
|
||||||
decoders::{base64::decode_base64, DecodeResult},
|
|
||||||
parsers::message::MessageStream,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn decode_base64_strings() {
|
fn decode_base64() {
|
||||||
let inputs = [
|
for (encoded_str, expected_result) in [
|
||||||
("VGVzdA==", "Test", "", true),
|
("VGVzdA==", "Test"),
|
||||||
("WWU=", "Ye", "", true),
|
("WWU=", "Ye"),
|
||||||
("QQ==", "A", "", true),
|
("QQ==", "A"),
|
||||||
("cm8=", "ro", "", true),
|
("cm8=", "ro"),
|
||||||
(
|
(
|
||||||
"QXJlIHlvdSBhIFNoaW1hbm8gb3IgQ2FtcGFnbm9sbyBwZXJzb24/",
|
"QXJlIHlvdSBhIFNoaW1hbm8gb3IgQ2FtcGFnbm9sbyBwZXJzb24/",
|
||||||
"Are you a Shimano or Campagnolo person?",
|
"Are you a Shimano or Campagnolo person?",
|
||||||
"",
|
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPC9ib2R5Pgo8L2h0bWw+Cg==",
|
"PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPC9ib2R5Pgo8L2h0bWw+Cg==",
|
||||||
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
|
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
|
||||||
"",
|
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==",
|
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==",
|
||||||
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
|
"<!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==",
|
"PCFET0NUWVBFIGh0bWw+CjxodG1sPg\no8Ym9ke\nT4KPC 9ib2R5Pg\n o8L2h0bWw+Cg==\r\n--boundary--\r\n",
|
||||||
"",
|
"<!DOCTYPE html>\n<html>\n<body>\n</body>\n</html>\n",
|
||||||
"",
|
),
|
||||||
true,
|
("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",
|
"w\n6\nH\nD\nq\nc\nO\nt\nw\n7\n P\tD u g\n==\n--boundary",
|
||||||
"áéíóú",
|
"áéíóú",
|
||||||
"\n--boundary",
|
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
("w6HDqcOtw7PDug================?=", "áéíóú", "?=", false),
|
] {
|
||||||
(
|
let mut s = MessageStream::new(encoded_str.as_bytes());
|
||||||
"w6HDqcOtw7PDug==\n--\n--boundary",
|
let (_, result) = s.decode_base64_mime(b"boundary");
|
||||||
"áéíóú",
|
|
||||||
"\n--boundary",
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
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!(
|
assert_eq!(
|
||||||
bytes_read > 0,
|
result,
|
||||||
!input.1.is_empty(),
|
expected_result.as_bytes(),
|
||||||
"Failed for '{:?}'",
|
"Failed for {encoded_str:?}",
|
||||||
input.0
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !input.1.is_empty() {
|
#[test]
|
||||||
let bytes = match result {
|
fn decode_base64_word() {
|
||||||
DecodeResult::Owned(v) => v,
|
for (encoded_str, expected_result) in [
|
||||||
_ => unreachable!(),
|
("w 6 H D q c O t w 7 P D u g== ?=", "áéíóú"),
|
||||||
};
|
("w6HDqcOtw7PDug==?=", "áéíóú"),
|
||||||
let result_str = std::str::from_utf8(&bytes).unwrap();
|
("w6HDqc\n Otw7PDug==?=", "áéíóú"),
|
||||||
//println!("'{}' -> '{}'", input.0.escape_debug(), result_str.escape_debug());
|
("w6HDqcOtw7PDug================?=", "áéíóú"),
|
||||||
assert_eq!(
|
("?=", ""),
|
||||||
result_str,
|
] {
|
||||||
input.1,
|
let mut s = MessageStream::new(encoded_str.as_bytes());
|
||||||
"Failed for '{}'",
|
assert_eq!(
|
||||||
input.0.escape_debug()
|
s.decode_base64_word().unwrap(),
|
||||||
);
|
expected_result.as_bytes(),
|
||||||
}
|
"Failed for {encoded_str:?}",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -16,7 +16,7 @@ use super::{
|
|||||||
DecoderFnc,
|
DecoderFnc,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn get_charset_decoder<'x>(charset: &[u8]) -> Option<DecoderFnc<'x>> {
|
pub fn charset_decoder(charset: &[u8]) -> Option<DecoderFnc> {
|
||||||
if (2..=45).contains(&charset.len()) {
|
if (2..=45).contains(&charset.len()) {
|
||||||
let mut l_charset = [0u8; 45];
|
let mut l_charset = [0u8; 45];
|
||||||
let mut hash: u32 = charset.len() as u32;
|
let mut hash: u32 = charset.len() as u32;
|
||||||
@@ -29,19 +29,47 @@ pub fn get_charset_decoder<'x>(charset: &[u8]) -> Option<DecoderFnc<'x>> {
|
|||||||
};
|
};
|
||||||
l_charset[pos] = ch;
|
l_charset[pos] = ch;
|
||||||
if let 0 | 3 | 6 | 7 | 8 | 9 = pos {
|
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 {
|
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) {
|
if (7..=764).contains(&hash) {
|
||||||
let hash = (hash - 7) as usize;
|
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) {
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::get_charset_decoder;
|
use super::charset_decoder;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn get_decoder_charset() {
|
#[allow(clippy::uninlined_format_args)]
|
||||||
|
fn decoder_charset() {
|
||||||
let inputs = [
|
let inputs = [
|
||||||
"l8",
|
"l8",
|
||||||
//"utf-8",
|
//"utf-8",
|
||||||
@@ -71,8 +100,8 @@ mod tests {
|
|||||||
|
|
||||||
for input in inputs {
|
for input in inputs {
|
||||||
assert!(
|
assert!(
|
||||||
get_charset_decoder(input.as_bytes()).is_some(),
|
charset_decoder(input.as_bytes()).is_some(),
|
||||||
"Failed for '{}'",
|
"Failed for {}",
|
||||||
input
|
input
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -477,7 +506,7 @@ static CH_MAP: &[&[u8]; 758] = &[
|
|||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"iso-ir-127",
|
b"iso-ir-127",
|
||||||
b"",
|
b"gb2312",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
@@ -550,7 +579,7 @@ static CH_MAP: &[&[u8]; 758] = &[
|
|||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"ks_c_5601-1989",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
@@ -660,7 +689,7 @@ static CH_MAP: &[&[u8]; 758] = &[
|
|||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"ks_c_5601-1987",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
b"",
|
b"",
|
||||||
@@ -1239,7 +1268,7 @@ static FNC_MAP: &[for<'x> fn(&'x [u8]) -> String; 758] = &[
|
|||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
decoder_iso_8859_6,
|
decoder_iso_8859_6,
|
||||||
no_op,
|
decoder_gb18030,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
@@ -1312,7 +1341,7 @@ static FNC_MAP: &[for<'x> fn(&'x [u8]) -> String; 758] = &[
|
|||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
decoder_euc_kr,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
@@ -1422,7 +1451,7 @@ static FNC_MAP: &[for<'x> fn(&'x [u8]) -> String; 758] = &[
|
|||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
decoder_euc_kr,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
no_op,
|
no_op,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -14,11 +14,11 @@ pub mod multi_byte;
|
|||||||
pub mod single_byte;
|
pub mod single_byte;
|
||||||
pub mod utf;
|
pub mod utf;
|
||||||
|
|
||||||
pub type DecoderFnc<'x> = fn(&'x [u8]) -> String;
|
pub type DecoderFnc = fn(&[u8]) -> String;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::map::get_charset_decoder;
|
use super::map::charset_decoder;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn decode_charset() {
|
fn decode_charset() {
|
||||||
@@ -65,7 +65,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for input in inputs {
|
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));
|
.expect(&("Failed to find decoder for ".to_owned() + input.0));
|
||||||
|
|
||||||
assert_eq!(decoder(&input.1), input.2);
|
assert_eq!(decoder(&input.1), input.2);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -12,9 +12,6 @@
|
|||||||
#[cfg(feature = "full_encoding")]
|
#[cfg(feature = "full_encoding")]
|
||||||
use encoding_rs::*;
|
use encoding_rs::*;
|
||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
|
||||||
use super::map::decoder_default;
|
|
||||||
|
|
||||||
#[cfg(feature = "full_encoding")]
|
#[cfg(feature = "full_encoding")]
|
||||||
fn multi_byte_decoder(mut decoder: Decoder, bytes: &[u8]) -> String {
|
fn multi_byte_decoder(mut decoder: Decoder, bytes: &[u8]) -> String {
|
||||||
let mut result = String::with_capacity(bytes.len() * 3);
|
let mut result = String::with_capacity(bytes.len() * 3);
|
||||||
@@ -35,7 +32,7 @@ pub fn decoder_shift_jis(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +44,7 @@ pub fn decoder_big5(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +56,7 @@ pub fn decoder_euc_jp(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +68,7 @@ pub fn decoder_euc_kr(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +80,7 @@ pub fn decoder_gb18030(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +92,7 @@ pub fn decoder_gbk(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +104,7 @@ pub fn decoder_iso2022_jp(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +116,7 @@ pub fn decoder_windows874(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +128,6 @@ pub fn decoder_ibm866(bytes: &[u8]) -> String {
|
|||||||
|
|
||||||
#[cfg(not(feature = "full_encoding"))]
|
#[cfg(not(feature = "full_encoding"))]
|
||||||
{
|
{
|
||||||
decoder_default(bytes)
|
String::from_utf8_lossy(bytes).into_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -13,6 +13,11 @@ fn single_byte_decoder(table: &[char], bytes: &[u8]) -> String {
|
|||||||
let mut result = String::with_capacity(bytes.len() * 2);
|
let mut result = String::with_capacity(bytes.len() * 2);
|
||||||
|
|
||||||
for byte in bytes {
|
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]);
|
result.push(table[*byte as usize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
|||||||
+90
-112
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,11 +9,9 @@
|
|||||||
* except according to those terms.
|
* 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::{
|
use super::DecodeWordFnc;
|
||||||
base64::decode_base64, quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Rfc2047State {
|
enum Rfc2047State {
|
||||||
Init,
|
Init,
|
||||||
@@ -22,179 +20,159 @@ enum Rfc2047State {
|
|||||||
Data,
|
Data,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_rfc2047(stream: &MessageStream, start_pos: usize) -> (usize, Option<String>) {
|
impl<'x> MessageStream<'x> {
|
||||||
let mut read_pos: usize = start_pos;
|
pub fn decode_rfc2047(&mut self) -> Option<String> {
|
||||||
let mut state = Rfc2047State::Init;
|
let mut state = Rfc2047State::Init;
|
||||||
|
|
||||||
let mut charset_start = 0;
|
let mut charset_start = 0;
|
||||||
let mut charset_end = 0;
|
let mut charset_end = 0;
|
||||||
let mut decode_fnc: Option<DecodeFnc> = None;
|
let mut decode_fnc: Option<DecodeWordFnc> = None;
|
||||||
|
|
||||||
for ch in stream.data[start_pos..].iter() {
|
while let Some(ch) = self.next() {
|
||||||
read_pos += 1;
|
match state {
|
||||||
|
Rfc2047State::Init => {
|
||||||
match state {
|
if ch != &b'?' {
|
||||||
Rfc2047State::Init => {
|
return None;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
if (charset_end - charset_start) < 2 {
|
state = Rfc2047State::Charset;
|
||||||
return (0, None);
|
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 {
|
||||||
b'*' => {
|
charset_end = self.offset() - 1;
|
||||||
if charset_end == charset_start {
|
}
|
||||||
charset_end = read_pos - 1;
|
|
||||||
}
|
}
|
||||||
}
|
b'\n' => {
|
||||||
b'\n' => {
|
return None;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
_ => (),
|
||||||
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream};
|
use crate::parsers::MessageStream;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn decode_rfc2047_string() {
|
fn decode_rfc2047() {
|
||||||
let inputs = [
|
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",
|
"this is some text",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"?iso-8859-1?q?this is some text?=".to_string(),
|
"?iso-8859-1?q?this is some text?=",
|
||||||
"this is some text",
|
"this is some text",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
("?US-ASCII?Q?Keith_Moore?=", "Keith Moore", false),
|
||||||
(
|
(
|
||||||
"?US-ASCII?Q?Keith_Moore?=".to_string(),
|
"?iso_8859-1:1987?Q?Keld_J=F8rn_Simonsen?=",
|
||||||
"Keith Moore",
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"?iso_8859-1:1987?Q?Keld_J=F8rn_Simonsen?=".to_string(),
|
|
||||||
"Keld Jørn Simonsen",
|
"Keld Jørn Simonsen",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=".to_string(),
|
"?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=",
|
||||||
"If you can read this yo",
|
"If you can read this yo",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=".to_string(),
|
"?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=",
|
||||||
"u understand the example.",
|
"u understand the example.",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
("?ISO-8859-1?Q?Olle_J=E4rnefors?=", "Olle Järnefors", true),
|
||||||
(
|
(
|
||||||
"?ISO-8859-1?Q?Olle_J=E4rnefors?=".to_string(),
|
"?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=",
|
||||||
"Olle Järnefors",
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=".to_string(),
|
|
||||||
"Patrik Fältström",
|
"Patrik Fältström",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
("?ISO-8859-1*?Q?a?=".to_string(), "a", true),
|
("?ISO-8859-1*?Q?a?=", "a", true),
|
||||||
("?ISO-8859-1**?Q?a_b?=".to_string(), "a b", 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",
|
"Thís ís válíd ÚTF8",
|
||||||
false,
|
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",
|
"Thís ís válíd ÚTF8",
|
||||||
false,
|
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,
|
true,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"?Iso-8859-6*arabic?b?5dHNyMcgyMfk2cfk5Q==?=".to_string(),
|
"?Iso-8859-6*arabic?b?5dHNyMcgyMfk2cfk5Q==?=",
|
||||||
"مرحبا بالعالم",
|
"مرحبا بالعالم",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
#[cfg(feature = "full_encoding")]
|
#[cfg(feature = "full_encoding")]
|
||||||
(
|
(
|
||||||
"?shift_jis?B?g26DjYFbgUWDj4Fbg4uDaA==?=".to_string(),
|
"?shift_jis?B?g26DjYFbgUWDj4Fbg4uDaA==?=",
|
||||||
"ハロー・ワールド",
|
"ハロー・ワールド",
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
#[cfg(feature = "full_encoding")]
|
#[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,
|
true,
|
||||||
),
|
),
|
||||||
];
|
] {
|
||||||
|
match MessageStream::new(input.as_bytes()).decode_rfc2047() {
|
||||||
for input in inputs {
|
Some(result) => {
|
||||||
let str = input.0.to_string();
|
|
||||||
|
|
||||||
match decode_rfc2047(&MessageStream::new(str.as_bytes()), 0) {
|
|
||||||
(_, Some(string)) => {
|
|
||||||
//println!("Decoded '{}'", string);
|
//println!("Decoded '{}'", string);
|
||||||
assert_eq!(string, input.1);
|
assert_eq!(result, expected_result);
|
||||||
}
|
}
|
||||||
_ => panic!("Failed to decode '{}'", input.0),
|
_ => panic!("Failed to decode '{}'", input),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
|||||||
+52
-10
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -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_HASH.len(), u8::MAX as usize + 5);
|
||||||
debug_assert_eq!(ENTITY_MAP.len(), 18079 - 64 + 1);
|
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 {
|
match pos {
|
||||||
0 | 5 | 6 | 9 | 11 => {
|
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 => {
|
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 => {
|
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 => {
|
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 {
|
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) {
|
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>");
|
result.extend_from_slice(b"<html><body>");
|
||||||
|
|
||||||
for ch in input {
|
for &ch in input {
|
||||||
match ch {
|
match ch {
|
||||||
b'\n' => result.extend_from_slice(b"<br/>"),
|
b'\n' => result.extend_from_slice(b"<br/>"),
|
||||||
b'<' => result.extend_from_slice(b"<"),
|
b'<' => result.extend_from_slice(b"<"),
|
||||||
b'\r' => (),
|
b'\r' => (),
|
||||||
_ => result.push(*ch),
|
_ => result.push(ch),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.extend_from_slice(b"</body></html>");
|
result.extend_from_slice(b"</body></html>");
|
||||||
|
|||||||
+6
-9
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,7 +9,9 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::parsers::message::MessageStream;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use crate::parsers::MessageStream;
|
||||||
|
|
||||||
pub mod base64;
|
pub mod base64;
|
||||||
pub mod charsets;
|
pub mod charsets;
|
||||||
@@ -18,10 +20,5 @@ pub mod hex;
|
|||||||
pub mod html;
|
pub mod html;
|
||||||
pub mod quoted_printable;
|
pub mod quoted_printable;
|
||||||
|
|
||||||
pub type DecodeFnc<'x> = fn(&MessageStream<'x>, usize, &[u8], bool) -> (usize, DecodeResult);
|
pub type DecodeFnc<'x> = fn(&mut MessageStream<'x>, &[u8]) -> (usize, Cow<'x, [u8]>);
|
||||||
|
pub type DecodeWordFnc<'x> = fn(&mut MessageStream<'x>) -> Option<Vec<u8>>;
|
||||||
pub enum DecodeResult {
|
|
||||||
Owned(Vec<u8>),
|
|
||||||
Borrowed((usize, usize)),
|
|
||||||
Empty,
|
|
||||||
}
|
|
||||||
|
|||||||
+322
-180
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::parsers::message::MessageStream;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use super::DecodeResult;
|
use crate::parsers::MessageStream;
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
enum QuotedPrintableState {
|
enum QuotedPrintableState {
|
||||||
@@ -20,153 +20,277 @@ enum QuotedPrintableState {
|
|||||||
Hex1,
|
Hex1,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_quoted_printable<'x>(
|
pub fn quoted_printable_decode(bytes: &[u8]) -> Option<Vec<u8>> {
|
||||||
stream: &MessageStream<'x>,
|
let mut buf = Vec::with_capacity(bytes.len());
|
||||||
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);
|
|
||||||
|
|
||||||
let mut state = QuotedPrintableState::None;
|
let mut state = QuotedPrintableState::None;
|
||||||
let mut match_count = 0;
|
|
||||||
let mut hex1 = 0;
|
let mut hex1 = 0;
|
||||||
|
|
||||||
debug_assert!(boundary.is_empty() || boundary.len() >= 2);
|
for &ch in bytes {
|
||||||
|
|
||||||
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);
|
|
||||||
is_boundary_end
|
|
||||||
};
|
|
||||||
|
|
||||||
if done {
|
|
||||||
success = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if match_count > 0 {
|
|
||||||
for ch in boundary[..match_count].iter() {
|
|
||||||
if *ch != b'\n' || QuotedPrintableState::Eq != state {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match ch {
|
match ch {
|
||||||
b'=' => {
|
b'=' => {
|
||||||
if let QuotedPrintableState::None = state {
|
if let QuotedPrintableState::None = state {
|
||||||
state = QuotedPrintableState::Eq
|
state = QuotedPrintableState::Eq
|
||||||
} else {
|
} else {
|
||||||
success = false;
|
return None;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b'\n' => {
|
b'\n' => {
|
||||||
if is_word {
|
if QuotedPrintableState::Eq == state {
|
||||||
success = false;
|
|
||||||
break;
|
|
||||||
} else if QuotedPrintableState::Eq == state {
|
|
||||||
state = QuotedPrintableState::None;
|
state = QuotedPrintableState::None;
|
||||||
} else {
|
} else {
|
||||||
buf.push(b'\n');
|
buf.push(b'\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b'_' if is_word => {
|
|
||||||
buf.push(b' ');
|
|
||||||
}
|
|
||||||
b'\r' => (),
|
b'\r' => (),
|
||||||
_ => match state {
|
_ => match state {
|
||||||
QuotedPrintableState::None => {
|
QuotedPrintableState::None => {
|
||||||
buf.push(*ch);
|
buf.push(ch);
|
||||||
}
|
}
|
||||||
QuotedPrintableState::Eq => {
|
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 {
|
if hex1 != -1 {
|
||||||
state = QuotedPrintableState::Hex1;
|
state = QuotedPrintableState::Hex1;
|
||||||
} else {
|
} else {
|
||||||
success = false;
|
return None;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QuotedPrintableState::Hex1 => {
|
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;
|
state = QuotedPrintableState::None;
|
||||||
if hex2 != -1 {
|
if hex2 != -1 {
|
||||||
let ch = ((hex1 as u8) << 4) | hex2 as u8;
|
buf.push(((hex1 as u8) << 4) | hex2 as u8);
|
||||||
|
|
||||||
buf.push(ch);
|
|
||||||
} else {
|
} else {
|
||||||
success = false;
|
return None;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
buf.into()
|
||||||
if success { bytes_read } else { 0 },
|
|
||||||
if !buf.is_empty() {
|
|
||||||
buf.shrink_to_fit();
|
|
||||||
DecodeResult::Owned(buf)
|
|
||||||
} else {
|
|
||||||
DecodeResult::Empty
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::parsers::MessageStream;
|
||||||
decoders::{quoted_printable::decode_quoted_printable, DecodeResult},
|
|
||||||
parsers::message::MessageStream,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn decode_quoted_printable_string() {
|
fn decode_quoted_printable() {
|
||||||
let inputs = [
|
for (encoded_str, expected_result) in [
|
||||||
(
|
(
|
||||||
concat!(
|
concat!(
|
||||||
"J'interdis aux marchands de vanter trop leurs marchandises. ",
|
"J'interdis aux marchands de vanter trop leurs marchandises. ",
|
||||||
@@ -185,26 +309,10 @@ mod tests {
|
|||||||
"est vulgaire ils te fabriquent pour te la vendre une âme vulgaire.\n",
|
"est vulgaire ils te fabriquent pour te la vendre une âme vulgaire.\n",
|
||||||
"— Antoine de Saint-Exupéry, Citadelle (1948)"
|
"— 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",
|
"— 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\n--",
|
|
||||||
"\n--boundary",
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry=\n--\n--boundary",
|
|
||||||
"— Antoine de Saint-Exupéry--",
|
|
||||||
"\n--boundary",
|
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
concat!(
|
concat!(
|
||||||
@@ -217,70 +325,104 @@ mod tests {
|
|||||||
"sprach ein Redner, \"in steter Furcht vor Menschen und ",
|
"sprach ein Redner, \"in steter Furcht vor Menschen und ",
|
||||||
"Tieren, eine Beute der Hunde, der\n"
|
"Tieren, eine Beute der Hunde, der\n"
|
||||||
),
|
),
|
||||||
"",
|
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
("this=20is=20some=20text?=", "this is some text", "?=", true),
|
("\n\n", "\n\n"),
|
||||||
("this is some text?=", "this is some text", "?=", true),
|
] {
|
||||||
("Keith_Moore?=", "Keith Moore", "?=", true),
|
assert_eq!(
|
||||||
("=2=123?=", "", "?=", true),
|
super::quoted_printable_decode(encoded_str.as_bytes()).unwrap_or_default(),
|
||||||
("= 20?=", "", "?=", true),
|
expected_result.as_bytes(),
|
||||||
("=====?=", "", "?=", true),
|
"Failed for {encoded_str:?}",
|
||||||
("=20=20=XX?=", "", "?=", true),
|
);
|
||||||
("=AX?=", "", "?=", true),
|
}
|
||||||
("=\n=\n==?=", "", "?=", true),
|
}
|
||||||
("=\r=1z?=", "", "?=", true),
|
|
||||||
("=|?=", "", "?=", true),
|
|
||||||
("????????=", "???????", "?=", true),
|
|
||||||
];
|
|
||||||
|
|
||||||
for input in inputs {
|
#[test]
|
||||||
let str = input.0.to_string();
|
fn decode_quoted_printable_mime() {
|
||||||
let stream = MessageStream::new(str.as_bytes());
|
for (encoded_str, expected_result) in [
|
||||||
|
(
|
||||||
let (bytes_read, result) =
|
"=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry\n--boundary",
|
||||||
decode_quoted_printable(&stream, 0, input.2.as_bytes(), input.3);
|
"— 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!(
|
assert_eq!(
|
||||||
bytes_read > 0,
|
result,
|
||||||
!input.1.is_empty(),
|
expected_result.as_bytes(),
|
||||||
"Failed for '{:?}'",
|
"Failed for {encoded_str:?}",
|
||||||
input.0
|
|
||||||
);
|
);
|
||||||
|
|
||||||
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
|
#[test]
|
||||||
for input in [b"\x0a\x0a\x00\x0b".to_vec(), b":B\x0a%".to_vec()] {
|
fn decode_quoted_printable_word() {
|
||||||
let stream = MessageStream::new(&input[..]);
|
for (encoded_str, expected_result) in [
|
||||||
decode_quoted_printable(&stream, 0, b"\n\n", true);
|
("this=20is=20some=20text?=", "this is some text"),
|
||||||
let stream = MessageStream::new(&input[..]);
|
("this=20is=20\n some=20text?=", "this is some text"),
|
||||||
decode_quoted_printable(&stream, 0, b"\n\n", false);
|
("this is some text?=", "this is some text"),
|
||||||
let stream = MessageStream::new(&input[..]);
|
("Keith_Moore?=", "Keith Moore"),
|
||||||
decode_quoted_printable(&stream, 0, &[], true);
|
("=2=123?=", ""),
|
||||||
let stream = MessageStream::new(&input[..]);
|
("= 20?=", ""),
|
||||||
decode_quoted_printable(&stream, 0, &[], false);
|
("=====?=", ""),
|
||||||
|
("=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:?}",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+977
-596
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,361 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
|
* file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||||
|
* option. This file may not be copied, modified, or distributed
|
||||||
|
* except according to those terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
fs, io,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Maildir folder iterator
|
||||||
|
pub struct FolderIterator<'x> {
|
||||||
|
inbox: Option<MessageIterator>,
|
||||||
|
it_stack: Vec<fs::ReadDir>,
|
||||||
|
name_stack: Vec<String>,
|
||||||
|
prefix: Option<&'x str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Maildir message iterator
|
||||||
|
pub struct MessageIterator {
|
||||||
|
name: Option<String>,
|
||||||
|
cur_it: fs::ReadDir,
|
||||||
|
new_it: fs::ReadDir,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Maildir message contents and metadata
|
||||||
|
#[derive(Debug, PartialEq, Eq, Clone, PartialOrd, Ord)]
|
||||||
|
pub struct Message {
|
||||||
|
internal_date: u64,
|
||||||
|
flags: Vec<Flag>,
|
||||||
|
contents: Vec<u8>,
|
||||||
|
path: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Flags of Maildir message
|
||||||
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, PartialOrd, Ord)]
|
||||||
|
pub enum Flag {
|
||||||
|
Passed,
|
||||||
|
Replied,
|
||||||
|
Seen,
|
||||||
|
Trashed,
|
||||||
|
Draft,
|
||||||
|
Flagged,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FolderIterator<'_> {
|
||||||
|
/// Creates a new Maildir folder iterator.
|
||||||
|
/// For Maildir++ mailboxes use `Some(".")` as the prefix.
|
||||||
|
/// For Dovecot Maildir mailboxes using LAYOUT=fs, use `None` as the prefix.
|
||||||
|
pub fn new(
|
||||||
|
path: impl Into<PathBuf>,
|
||||||
|
sub_folder_prefix: Option<&str>,
|
||||||
|
) -> io::Result<FolderIterator> {
|
||||||
|
let path = path.into();
|
||||||
|
|
||||||
|
Ok(FolderIterator {
|
||||||
|
it_stack: vec![fs::read_dir(&path)?],
|
||||||
|
name_stack: Vec::new(),
|
||||||
|
inbox: match MessageIterator::new_(&path, None) {
|
||||||
|
Ok(inbox) => inbox.into(),
|
||||||
|
Err(err) => {
|
||||||
|
if err.kind() == io::ErrorKind::NotFound {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
prefix: sub_folder_prefix,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MessageIterator {
|
||||||
|
/// Creates a new Maildir message iterator
|
||||||
|
pub fn new(path: impl Into<PathBuf>) -> io::Result<MessageIterator> {
|
||||||
|
MessageIterator::new_(&path.into(), None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_(path: &Path, name: Option<String>) -> io::Result<MessageIterator> {
|
||||||
|
let mut cur_path = path.to_path_buf();
|
||||||
|
cur_path.push("cur");
|
||||||
|
if !cur_path.exists() {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::NotFound,
|
||||||
|
"Invalid Maildir format, 'cur' directory not found.",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let mut new_path = path.to_path_buf();
|
||||||
|
new_path.push("new");
|
||||||
|
if !new_path.exists() {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::NotFound,
|
||||||
|
"Invalid Maildir format, 'new' directory not found.",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(MessageIterator {
|
||||||
|
name,
|
||||||
|
cur_it: fs::read_dir(cur_path)?,
|
||||||
|
new_it: fs::read_dir(new_path)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the mailbox name of None for 'INBOX'.
|
||||||
|
pub fn name(&self) -> Option<&str> {
|
||||||
|
self.name.as_deref()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Iterator for FolderIterator<'_> {
|
||||||
|
type Item = io::Result<MessageIterator>;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
if let Some(inbox) = self.inbox.take() {
|
||||||
|
return Some(Ok(inbox));
|
||||||
|
}
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let entry = match self.it_stack.last_mut().unwrap().next() {
|
||||||
|
Some(Ok(entry)) => entry,
|
||||||
|
Some(Err(err)) => return Some(Err(err)),
|
||||||
|
None => {
|
||||||
|
self.it_stack.pop();
|
||||||
|
self.name_stack.pop();
|
||||||
|
|
||||||
|
if !self.it_stack.is_empty() {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let path = entry.path();
|
||||||
|
if path.is_dir() {
|
||||||
|
if let Some(name) =
|
||||||
|
path.file_name()
|
||||||
|
.and_then(|name| name.to_str())
|
||||||
|
.and_then(|name| {
|
||||||
|
if !["cur", "new", "tmp"].contains(&name) {
|
||||||
|
if let Some(prefix) = self.prefix {
|
||||||
|
name.strip_prefix(prefix)
|
||||||
|
} else {
|
||||||
|
name.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
{
|
||||||
|
match fs::read_dir(&path) {
|
||||||
|
Ok(next_it) => {
|
||||||
|
self.it_stack.push(next_it);
|
||||||
|
self.name_stack.push(name.to_string());
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
return Some(Err(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match MessageIterator::new_(
|
||||||
|
&path,
|
||||||
|
self.name_stack.join(self.prefix.unwrap_or("/")).into(),
|
||||||
|
) {
|
||||||
|
Ok(folder) => return Some(Ok(folder)),
|
||||||
|
Err(err) => {
|
||||||
|
if err.kind() != io::ErrorKind::NotFound {
|
||||||
|
return Some(Err(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Iterator for MessageIterator {
|
||||||
|
type Item = io::Result<Message>;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
loop {
|
||||||
|
let entry = match self.cur_it.next().or_else(|| self.new_it.next()) {
|
||||||
|
Some(Ok(entry)) => entry,
|
||||||
|
Some(Err(err)) => return Some(Err(err)),
|
||||||
|
None => return None,
|
||||||
|
};
|
||||||
|
let path = entry.path();
|
||||||
|
if path.is_file() {
|
||||||
|
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.modified()).and_then(|d| {
|
||||||
|
d.duration_since(std::time::UNIX_EPOCH)
|
||||||
|
.map(|d| d.as_secs())
|
||||||
|
.map_err(|e| {
|
||||||
|
io::Error::new(io::ErrorKind::InvalidData, e.to_string())
|
||||||
|
})
|
||||||
|
}) {
|
||||||
|
Ok(metadata) => metadata,
|
||||||
|
Err(err) => return Some(Err(err)),
|
||||||
|
};
|
||||||
|
let contents = match fs::read(&path) {
|
||||||
|
Ok(contents) => contents,
|
||||||
|
Err(err) => return Some(Err(err)),
|
||||||
|
};
|
||||||
|
let mut flags = Vec::new();
|
||||||
|
if let Some((_, part)) = name.rsplit_once("2,") {
|
||||||
|
for &ch in part.as_bytes() {
|
||||||
|
match ch {
|
||||||
|
b'P' => flags.push(Flag::Passed),
|
||||||
|
b'R' => flags.push(Flag::Replied),
|
||||||
|
b'S' => flags.push(Flag::Seen),
|
||||||
|
b'T' => flags.push(Flag::Trashed),
|
||||||
|
b'D' => flags.push(Flag::Draft),
|
||||||
|
b'F' => flags.push(Flag::Flagged),
|
||||||
|
_ => {
|
||||||
|
if !ch.is_ascii_alphanumeric() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Some(Ok(Message {
|
||||||
|
contents,
|
||||||
|
internal_date,
|
||||||
|
flags,
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Message {
|
||||||
|
/// Returns the message creation date in seconds since UNIX epoch
|
||||||
|
pub fn internal_date(&self) -> u64 {
|
||||||
|
self.internal_date
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the message flags
|
||||||
|
pub fn flags(&self) -> &[Flag] {
|
||||||
|
&self.flags
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the path to the message file
|
||||||
|
pub fn path(&self) -> &Path {
|
||||||
|
&self.path
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the message contents
|
||||||
|
pub fn contents(&self) -> &[u8] {
|
||||||
|
&self.contents
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unwraps the message contents
|
||||||
|
pub fn unwrap_contents(self) -> Vec<u8> {
|
||||||
|
self.contents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use crate::mailbox::maildir::{Flag, Message};
|
||||||
|
|
||||||
|
use super::FolderIterator;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_maildir() {
|
||||||
|
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
test_dir.push("tests");
|
||||||
|
test_dir.push("maildir");
|
||||||
|
|
||||||
|
let mut messages = Vec::new();
|
||||||
|
let expected_messages = vec![
|
||||||
|
(
|
||||||
|
"INBOX".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![Flag::Seen],
|
||||||
|
contents: vec![98, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"INBOX".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![Flag::Seen, Flag::Trashed],
|
||||||
|
contents: vec![97, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"My Folder".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![],
|
||||||
|
contents: vec![100, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"My Folder".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![Flag::Trashed, Flag::Draft, Flag::Replied],
|
||||||
|
contents: vec![99, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"My Folder.Nested Folder".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![Flag::Replied, Flag::Draft, Flag::Flagged],
|
||||||
|
contents: vec![102, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"My Folder.Nested Folder".to_string(),
|
||||||
|
Message {
|
||||||
|
internal_date: 0,
|
||||||
|
flags: vec![Flag::Flagged, Flag::Passed],
|
||||||
|
contents: vec![101, 10],
|
||||||
|
path: "unknown".into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
for folder in FolderIterator::new(test_dir, ".".into()).unwrap() {
|
||||||
|
let folder = folder.unwrap();
|
||||||
|
let name = folder.name().unwrap_or("INBOX").to_string();
|
||||||
|
|
||||||
|
for message in folder {
|
||||||
|
let mut message = message.unwrap();
|
||||||
|
assert_ne!(message.internal_date(), 0);
|
||||||
|
assert!(message.path.exists());
|
||||||
|
message.internal_date = 0;
|
||||||
|
message.path = PathBuf::from("unknown");
|
||||||
|
messages.push((name.clone(), message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
messages.sort_unstable();
|
||||||
|
assert_eq!(messages, expected_messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,279 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
|
* file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||||
|
* option. This file may not be copied, modified, or distributed
|
||||||
|
* except according to those terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::DateTime;
|
||||||
|
use std::io::{BufRead, BufReader, Read};
|
||||||
|
|
||||||
|
/// Parses an Mbox mailbox from a `Read` stream, returning each message as a
|
||||||
|
/// `Vec<u8>`.
|
||||||
|
/// supports >From quoting as defined in the [QMail mbox specification](http://qmail.org/qmail-manual-html/man5/mbox.html).
|
||||||
|
pub struct MessageIterator<T: Read> {
|
||||||
|
reader: BufReader<T>,
|
||||||
|
message: Option<Message>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mbox message contents and metadata
|
||||||
|
#[derive(Debug, PartialEq, Eq, Clone, PartialOrd, Ord)]
|
||||||
|
pub struct Message {
|
||||||
|
internal_date: u64,
|
||||||
|
from: String,
|
||||||
|
contents: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct ParseError {}
|
||||||
|
|
||||||
|
impl<T> MessageIterator<T>
|
||||||
|
where
|
||||||
|
T: Read,
|
||||||
|
{
|
||||||
|
pub fn new(reader: T) -> MessageIterator<T> {
|
||||||
|
MessageIterator {
|
||||||
|
reader: BufReader::new(reader),
|
||||||
|
message: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Iterator for MessageIterator<T>
|
||||||
|
where
|
||||||
|
T: Read,
|
||||||
|
{
|
||||||
|
type Item = Result<Message, ParseError>;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
let mut message_line = Vec::with_capacity(80);
|
||||||
|
|
||||||
|
loop {
|
||||||
|
match self.reader.read_until(b'\n', &mut message_line) {
|
||||||
|
Ok(bytes_read) => {
|
||||||
|
if bytes_read == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return Some(Err(ParseError {}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let is_from = message_line
|
||||||
|
.get(..5)
|
||||||
|
.map(|line| line == b"From ")
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
if let Some(message) = &mut self.message {
|
||||||
|
if !is_from {
|
||||||
|
if message_line[0] != b'>' {
|
||||||
|
message.contents.append(&mut message_line);
|
||||||
|
} else if message_line
|
||||||
|
.iter()
|
||||||
|
.skip_while(|&&ch| ch == b'>')
|
||||||
|
.take(5)
|
||||||
|
.copied()
|
||||||
|
.collect::<Vec<u8>>()
|
||||||
|
== b"From "
|
||||||
|
{
|
||||||
|
message.contents.extend_from_slice(&message_line[1..]);
|
||||||
|
message_line.clear();
|
||||||
|
} else {
|
||||||
|
message.contents.append(&mut message_line);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let message = self.message.take().map(Ok);
|
||||||
|
self.message =
|
||||||
|
Message::new(std::str::from_utf8(&message_line).unwrap_or("")).into();
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if is_from {
|
||||||
|
self.message =
|
||||||
|
Message::new(std::str::from_utf8(&message_line).unwrap_or("")).into();
|
||||||
|
}
|
||||||
|
message_line.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.message.take().map(Ok)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Message {
|
||||||
|
fn new(hdr: &str) -> Self {
|
||||||
|
let (internal_date, from) = if let Some((from, date)) = hdr
|
||||||
|
.strip_prefix("From ")
|
||||||
|
.and_then(|hdr| hdr.split_once(' '))
|
||||||
|
{
|
||||||
|
let mut dt = DateTime {
|
||||||
|
year: u16::MAX,
|
||||||
|
month: u8::MAX,
|
||||||
|
day: u8::MAX,
|
||||||
|
hour: u8::MAX,
|
||||||
|
minute: u8::MAX,
|
||||||
|
second: u8::MAX,
|
||||||
|
tz_before_gmt: false,
|
||||||
|
tz_hour: 0,
|
||||||
|
tz_minute: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (pos, part) in date.split_whitespace().enumerate() {
|
||||||
|
match pos {
|
||||||
|
1 => {
|
||||||
|
dt.month = if part.eq_ignore_ascii_case("jan") {
|
||||||
|
1
|
||||||
|
} else if part.eq_ignore_ascii_case("feb") {
|
||||||
|
2
|
||||||
|
} else if part.eq_ignore_ascii_case("mar") {
|
||||||
|
3
|
||||||
|
} else if part.eq_ignore_ascii_case("apr") {
|
||||||
|
4
|
||||||
|
} else if part.eq_ignore_ascii_case("may") {
|
||||||
|
5
|
||||||
|
} else if part.eq_ignore_ascii_case("jun") {
|
||||||
|
6
|
||||||
|
} else if part.eq_ignore_ascii_case("jul") {
|
||||||
|
7
|
||||||
|
} else if part.eq_ignore_ascii_case("aug") {
|
||||||
|
8
|
||||||
|
} else if part.eq_ignore_ascii_case("sep") {
|
||||||
|
9
|
||||||
|
} else if part.eq_ignore_ascii_case("oct") {
|
||||||
|
10
|
||||||
|
} else if part.eq_ignore_ascii_case("nov") {
|
||||||
|
11
|
||||||
|
} else if part.eq_ignore_ascii_case("dec") {
|
||||||
|
12
|
||||||
|
} else {
|
||||||
|
u8::MAX
|
||||||
|
};
|
||||||
|
}
|
||||||
|
2 => {
|
||||||
|
dt.day = part.parse().unwrap_or(u8::MAX);
|
||||||
|
}
|
||||||
|
3 => {
|
||||||
|
for (pos, part) in part.split(':').enumerate() {
|
||||||
|
match pos {
|
||||||
|
0 => {
|
||||||
|
dt.hour = part.parse().unwrap_or(u8::MAX);
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
dt.minute = part.parse().unwrap_or(u8::MAX);
|
||||||
|
}
|
||||||
|
2 => {
|
||||||
|
dt.second = part.parse().unwrap_or(u8::MAX);
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
4 => {
|
||||||
|
dt.year = part.parse().unwrap_or(u16::MAX);
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
if dt.is_valid() {
|
||||||
|
dt.to_timestamp() as u64
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
},
|
||||||
|
from.trim().to_string(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(0, "".to_string())
|
||||||
|
};
|
||||||
|
|
||||||
|
Self {
|
||||||
|
internal_date,
|
||||||
|
from,
|
||||||
|
contents: Vec::with_capacity(1024),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the message creation date in UTC seconds since UNIX epoch
|
||||||
|
pub fn internal_date(&self) -> u64 {
|
||||||
|
self.internal_date
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the message sender address
|
||||||
|
pub fn from(&self) -> &str {
|
||||||
|
&self.from
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the message contents
|
||||||
|
pub fn contents(&self) -> &[u8] {
|
||||||
|
&self.contents
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unwraps the message contents
|
||||||
|
pub fn unwrap_contents(self) -> Vec<u8> {
|
||||||
|
self.contents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::mailbox::mbox::Message;
|
||||||
|
|
||||||
|
use super::MessageIterator;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_mbox() {
|
||||||
|
let message = br#"From god@heaven.af.mil Sat Jan 3 01:05:34 1996
|
||||||
|
Message 1
|
||||||
|
|
||||||
|
From cras@irccrew.org Tue Jul 23 19:39:23 2002
|
||||||
|
Message 2
|
||||||
|
|
||||||
|
From test@test.com Tue Aug 6 13:34:34 2002
|
||||||
|
Message 3
|
||||||
|
>From hello
|
||||||
|
>>From world
|
||||||
|
>>>From test
|
||||||
|
|
||||||
|
From other@domain.com Mon Jan 15 15:30:00 2018
|
||||||
|
Message 4
|
||||||
|
> From
|
||||||
|
>F
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let parser = MessageIterator::new(&message[..]);
|
||||||
|
let expected_messages = vec![
|
||||||
|
Message {
|
||||||
|
internal_date: 820631134,
|
||||||
|
from: "god@heaven.af.mil".to_string(),
|
||||||
|
contents: b"Message 1\n\n".to_vec(),
|
||||||
|
},
|
||||||
|
Message {
|
||||||
|
internal_date: 1027453163,
|
||||||
|
from: "cras@irccrew.org".to_string(),
|
||||||
|
contents: b"Message 2\n\n".to_vec(),
|
||||||
|
},
|
||||||
|
Message {
|
||||||
|
internal_date: 1028640874,
|
||||||
|
from: "test@test.com".to_string(),
|
||||||
|
contents: b"Message 3\nFrom hello\n>From world\n>>From test\n\n".to_vec(),
|
||||||
|
},
|
||||||
|
Message {
|
||||||
|
internal_date: 1516030200,
|
||||||
|
from: "other@domain.com".to_string(),
|
||||||
|
contents: b"Message 4\n> From\n>F\n".to_vec(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
for (message, expected_messages) in parser.zip(expected_messages) {
|
||||||
|
assert_eq!(message.unwrap(), expected_messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod maildir;
|
||||||
|
pub mod mbox;
|
||||||
+400
-321
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::{
|
use crate::{parsers::MessageStream, Addr, Group, HeaderValue};
|
||||||
decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, Addr, Group,
|
|
||||||
HeaderValue,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Clone, Copy, Debug)]
|
||||||
enum AddressState {
|
enum AddressState {
|
||||||
@@ -45,45 +42,336 @@ pub struct AddressParser<'x> {
|
|||||||
result: Vec<Group<'x>>,
|
result: Vec<Group<'x>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_token<'x>(
|
impl<'x> AddressParser<'x> {
|
||||||
parser: &mut AddressParser<'x>,
|
pub fn add_token(&mut self, stream: &MessageStream<'x>, add_trail_space: bool) {
|
||||||
stream: &MessageStream<'x>,
|
if self.token_start > 0 {
|
||||||
add_trail_space: bool,
|
let token = String::from_utf8_lossy(&stream.data[self.token_start - 1..self.token_end]);
|
||||||
) {
|
let mut add_space = false;
|
||||||
if parser.token_start > 0 {
|
let list = match self.state {
|
||||||
let token = String::from_utf8_lossy(&stream.data[parser.token_start - 1..parser.token_end]);
|
AddressState::Address => &mut self.mail_tokens,
|
||||||
let mut add_space = false;
|
AddressState::Name => {
|
||||||
let list = match parser.state {
|
if self.is_token_email {
|
||||||
AddressState::Address => &mut parser.mail_tokens,
|
&mut self.mail_tokens
|
||||||
AddressState::Name => {
|
} else {
|
||||||
if parser.is_token_email {
|
add_space = true;
|
||||||
&mut parser.mail_tokens
|
&mut self.name_tokens
|
||||||
} else {
|
}
|
||||||
add_space = true;
|
|
||||||
&mut parser.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 => {
|
list.push(token);
|
||||||
add_space = true;
|
|
||||||
&mut parser.comment_tokens
|
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() {
|
while let Some(ch) = self.next() {
|
||||||
list.push(" ".into());
|
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 && !parser.is_escaped => {
|
||||||
|
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 {
|
if parser.group_name.is_some() || !parser.result.is_empty() {
|
||||||
list.push(" ".into());
|
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) {
|
pub fn parse_address_local_part(addr: &str) -> Option<&str> {
|
||||||
let has_mail = !parser.mail_tokens.is_empty();
|
let addr = addr.as_bytes();
|
||||||
let has_name = !parser.name_tokens.is_empty();
|
let mut iter = addr.iter().enumerate();
|
||||||
let has_comment = !parser.comment_tokens.is_empty();
|
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
|
None
|
||||||
.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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_group_details(parser: &mut AddressParser) {
|
pub fn parse_address_domain(addr: &str) -> Option<&str> {
|
||||||
if !parser.name_tokens.is_empty() {
|
let addr = addr.as_bytes();
|
||||||
parser.group_name = concat_tokens(&mut parser.name_tokens).into();
|
for (pos, &ch) in addr.iter().enumerate() {
|
||||||
}
|
if ch == b'@' {
|
||||||
|
return if pos > 0 && pos + 1 < addr.len() {
|
||||||
if !parser.comment_tokens.is_empty() {
|
std::str::from_utf8(addr.get(pos + 1..)?).ok()
|
||||||
parser.group_comment = concat_tokens(&mut parser.comment_tokens).into();
|
} else {
|
||||||
}
|
None
|
||||||
|
};
|
||||||
if !parser.mail_tokens.is_empty() {
|
} else if !ch.is_ascii() {
|
||||||
if parser.group_name.is_none() {
|
return 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(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_group(parser: &mut AddressParser) {
|
pub fn parse_address_user_part(addr: &str) -> Option<&str> {
|
||||||
let has_name = parser.group_name.is_some();
|
let addr = addr.as_bytes();
|
||||||
let has_comment = parser.group_comment.is_some();
|
|
||||||
let has_addresses = !parser.addresses.is_empty();
|
|
||||||
|
|
||||||
parser
|
let mut iter = addr.iter().enumerate();
|
||||||
.result
|
while let Some((pos, &ch)) = iter.next() {
|
||||||
.push(if has_name && has_addresses && has_comment {
|
if ch == b'+' {
|
||||||
Group {
|
if pos > 0 {
|
||||||
name: Some(
|
while let Some((_, &ch)) = iter.next() {
|
||||||
format!(
|
if ch == b'@' && iter.next().is_some() {
|
||||||
"{} ({})",
|
return std::str::from_utf8(addr.get(..pos)?).ok();
|
||||||
parser.group_name.take().unwrap(),
|
}
|
||||||
parser.group_comment.take().unwrap()
|
}
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
),
|
|
||||||
addresses: std::mem::take(&mut parser.addresses),
|
|
||||||
}
|
}
|
||||||
} else if has_addresses && has_name {
|
return None;
|
||||||
Group {
|
} else if ch == b'@' {
|
||||||
name: parser.group_name.take(),
|
return if pos > 0 && iter.next().is_some() {
|
||||||
addresses: std::mem::take(&mut parser.addresses),
|
std::str::from_utf8(addr.get(..pos)?).ok()
|
||||||
}
|
} else {
|
||||||
} else if has_addresses {
|
None
|
||||||
Group {
|
};
|
||||||
name: parser.group_comment.take(),
|
} else if !ch.is_ascii() {
|
||||||
addresses: std::mem::take(&mut parser.addresses),
|
return None;
|
||||||
}
|
}
|
||||||
} else if has_name {
|
}
|
||||||
Group {
|
|
||||||
name: parser.group_name.take(),
|
None
|
||||||
addresses: Vec::new(),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_address<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
|
pub fn parse_address_detail_part(addr: &str) -> Option<&str> {
|
||||||
let mut parser = AddressParser {
|
let addr = addr.as_bytes();
|
||||||
token_start: 0,
|
let mut plus_pos = usize::MAX;
|
||||||
token_end: 0,
|
|
||||||
|
|
||||||
is_token_email: false,
|
let mut iter = addr.iter().enumerate();
|
||||||
is_token_start: true,
|
while let Some((pos, &ch)) = iter.next() {
|
||||||
is_escaped: false,
|
if ch == b'+' {
|
||||||
|
plus_pos = pos + 1;
|
||||||
name_tokens: Vec::with_capacity(3),
|
} else if ch == b'@' {
|
||||||
mail_tokens: Vec::with_capacity(3),
|
if plus_pos != usize::MAX && iter.next().is_some() {
|
||||||
comment_tokens: Vec::with_capacity(3),
|
return std::str::from_utf8(addr.get(plus_pos..pos)?).ok();
|
||||||
|
} else {
|
||||||
state: AddressState::Name,
|
return None;
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
b'\\' if parser.state != AddressState::Name => {
|
} else if !ch.is_ascii() {
|
||||||
if parser.token_start > 0 {
|
return None;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_address(&mut parser);
|
None
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_addresses() {
|
fn parse_addresses() {
|
||||||
use crate::parsers::fields::address::parse_address;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
let inputs = [
|
let inputs = [
|
||||||
@@ -919,11 +989,20 @@ mod tests {
|
|||||||
" address: \"mailto:listmom@host.com\"\n"
|
" address: \"mailto:listmom@host.com\"\n"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
r#""\\\\\\\\S. NIG\\\\\\\\" <first.last@host.com>"#,
|
||||||
|
concat!(
|
||||||
|
"---\n",
|
||||||
|
"Address:\n",
|
||||||
|
" name: \"\\\\\\\\\\\\\\\\S. NIG\\\\\\\\\\\\\\\\\"\n",
|
||||||
|
" address: first.last@host.com\n",
|
||||||
|
),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
for input in inputs {
|
for input in inputs {
|
||||||
let str = input.0.to_string();
|
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);
|
let expected: HeaderValue = serde_yaml::from_str(input.1).unwrap_or(HeaderValue::Empty);
|
||||||
|
|
||||||
/*if input.0.len() >= 70 {
|
/*if input.0.len() >= 70 {
|
||||||
|
|||||||
+422
-373
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,14 +9,11 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{
|
use std::borrow::Cow;
|
||||||
borrow::Cow,
|
|
||||||
collections::{hash_map::Entry, HashMap},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
decoders::{charsets::map::get_charset_decoder, encoded_word::decode_rfc2047, hex::decode_hex},
|
decoders::{charsets::map::charset_decoder, hex::decode_hex},
|
||||||
parsers::message::MessageStream,
|
parsers::MessageStream,
|
||||||
ContentType, HeaderValue,
|
ContentType, HeaderValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,7 +41,7 @@ struct ContentTypeParser<'x> {
|
|||||||
attr_position: u32,
|
attr_position: u32,
|
||||||
|
|
||||||
values: Vec<Cow<'x, str>>,
|
values: Vec<Cow<'x, str>>,
|
||||||
attributes: HashMap<Cow<'x, str>, Cow<'x, str>>,
|
attributes: Vec<(Cow<'x, str>, Cow<'x, str>)>,
|
||||||
continuations: Option<Vec<Continuation<'x>>>,
|
continuations: Option<Vec<Continuation<'x>>>,
|
||||||
|
|
||||||
token_start: usize,
|
token_start: usize,
|
||||||
@@ -53,277 +50,294 @@ struct ContentTypeParser<'x> {
|
|||||||
is_continuation: bool,
|
is_continuation: bool,
|
||||||
is_encoded_attribute: bool,
|
is_encoded_attribute: bool,
|
||||||
is_escaped: bool,
|
is_escaped: bool,
|
||||||
|
remove_crlf: bool,
|
||||||
is_lower_case: bool,
|
is_lower_case: bool,
|
||||||
is_token_start: bool,
|
is_token_start: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
impl<'x> ContentTypeParser<'x> {
|
||||||
fn reset_parser(parser: &mut ContentTypeParser) {
|
#[inline(always)]
|
||||||
parser.token_start = 0;
|
fn reset_parser(&mut self) {
|
||||||
parser.is_token_start = true;
|
self.token_start = 0;
|
||||||
}
|
self.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
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn add_attribute_parameter<'x>(parser: &mut ContentTypeParser<'x>, stream: &MessageStream<'x>) {
|
fn add_attribute(&mut self, stream: &MessageStream<'x>) -> bool {
|
||||||
if parser.token_start > 0 {
|
if self.token_start > 0 {
|
||||||
let attr_part =
|
let mut attr = Some(String::from_utf8_lossy(
|
||||||
String::from_utf8_lossy(&stream.data[parser.token_start - 1..parser.token_end]);
|
&stream.data[self.token_start - 1..self.token_end],
|
||||||
|
));
|
||||||
|
|
||||||
if parser.attr_charset.is_none() {
|
if !self.is_lower_case {
|
||||||
parser.attr_charset = attr_part.into();
|
attr.as_mut().unwrap().to_mut().make_ascii_lowercase();
|
||||||
} else if let Entry::Vacant(e) = parser.attributes.entry(
|
self.is_lower_case = true;
|
||||||
parser
|
}
|
||||||
.attr_name
|
|
||||||
.as_ref()
|
match self.state {
|
||||||
.unwrap_or(&"unknown".into())
|
ContentState::AttributeName => self.attr_name = attr,
|
||||||
.clone()
|
ContentState::Type => self.c_type = attr,
|
||||||
+ "-language",
|
ContentState::SubType => self.c_subtype = attr,
|
||||||
) {
|
_ => unreachable!(),
|
||||||
e.insert(attr_part);
|
}
|
||||||
|
|
||||||
|
self.reset_parser();
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
parser.values.push("'".into());
|
false
|
||||||
parser.values.push(attr_part);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_parser(parser);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn add_partial_value<'x>(
|
fn add_attribute_parameter(&mut self, stream: &MessageStream<'x>) {
|
||||||
parser: &mut ContentTypeParser<'x>,
|
if self.token_start > 0 {
|
||||||
stream: &MessageStream<'x>,
|
let attr_part =
|
||||||
to_cur_pos: bool,
|
String::from_utf8_lossy(&stream.data[self.token_start - 1..self.token_end]);
|
||||||
) {
|
|
||||||
if parser.token_start > 0 {
|
|
||||||
let in_quote = parser.state == ContentState::AttributeQuotedValue;
|
|
||||||
|
|
||||||
parser.values.push(String::from_utf8_lossy(
|
if self.attr_charset.is_none() {
|
||||||
&stream.data[parser.token_start - 1..if in_quote && to_cur_pos {
|
self.attr_charset = attr_part.into();
|
||||||
stream.pos - 1
|
|
||||||
} else {
|
} else {
|
||||||
parser.token_end
|
let attr_name =
|
||||||
}],
|
self.attr_name.as_ref().unwrap_or(&"unknown".into()).clone() + "-language";
|
||||||
));
|
|
||||||
if !in_quote {
|
if !self.attributes.iter().any(|(name, _)| name == &attr_name) {
|
||||||
parser.values.push(" ".into());
|
self.attributes.push((attr_name, attr_part));
|
||||||
|
} else {
|
||||||
|
self.values.push("'".into());
|
||||||
|
self.values.push(attr_part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.reset_parser();
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
fn add_partial_value(&mut self, stream: &MessageStream<'x>, to_cur_pos: bool) {
|
||||||
let value = if parser.token_start > 0 {
|
if self.token_start > 0 {
|
||||||
Some(String::from_utf8_lossy(
|
let in_quote = self.state == ContentState::AttributeQuotedValue;
|
||||||
&stream.data[parser.token_start - 1..parser.token_end],
|
|
||||||
))
|
self.values.push(String::from_utf8_lossy(
|
||||||
} else {
|
&stream.data[self.token_start - 1..if in_quote && to_cur_pos {
|
||||||
if !has_values {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
if !parser.is_continuation {
|
let has_values = !self.values.is_empty();
|
||||||
parser.attributes.insert(
|
let value = if self.token_start > 0 {
|
||||||
parser.attr_name.take().unwrap(),
|
let value = &stream.data[self.token_start - 1..self.token_end];
|
||||||
|
Some(if !self.remove_crlf {
|
||||||
|
String::from_utf8_lossy(value)
|
||||||
|
} else {
|
||||||
|
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(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
if !has_values {
|
if !has_values {
|
||||||
value.unwrap()
|
return;
|
||||||
} else {
|
|
||||||
if let Some(value) = value {
|
|
||||||
parser.values.push(value);
|
|
||||||
}
|
|
||||||
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 {
|
None
|
||||||
parser.values.concat().into()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if parser.is_encoded_attribute {
|
if !self.is_continuation {
|
||||||
if let (true, decoded_bytes) = decode_hex(value.as_bytes()) {
|
self.attributes.push((
|
||||||
value = if let Some(decoder) = parser
|
self.attr_name.take().unwrap(),
|
||||||
.attr_charset
|
if !has_values {
|
||||||
.as_ref()
|
value.unwrap()
|
||||||
.and_then(|c| get_charset_decoder(c.as_bytes()))
|
|
||||||
{
|
|
||||||
decoder(&decoded_bytes).into()
|
|
||||||
} else {
|
} else {
|
||||||
String::from_utf8(decoded_bytes)
|
if let Some(value) = value {
|
||||||
.unwrap_or_else(|e| String::from_utf8_lossy(e.as_bytes()).into_owned())
|
self.values.push(value);
|
||||||
.into()
|
}
|
||||||
|
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 {
|
} else {
|
||||||
parser.continuations = Some(vec![continuation]);
|
self.values.concat().into()
|
||||||
}
|
};
|
||||||
|
|
||||||
parser.attr_position = 0;
|
if self.is_encoded_attribute {
|
||||||
} else {
|
if let (true, decoded_bytes) = decode_hex(value.as_bytes()) {
|
||||||
parser.attributes.insert(attr_name, value);
|
value = if let Some(decoder) = self
|
||||||
}
|
.attr_charset
|
||||||
parser.is_continuation = false;
|
.as_ref()
|
||||||
parser.attr_charset = None;
|
.and_then(|c| charset_decoder(c.as_bytes()))
|
||||||
}
|
|
||||||
|
|
||||||
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(..) {
|
|
||||||
let value = if let Some(old_value) = parser.attributes.get(&key) {
|
|
||||||
old_value.to_owned() + value
|
|
||||||
} else {
|
|
||||||
value
|
|
||||||
};
|
|
||||||
parser.attributes.insert(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: HashMap::new(),
|
|
||||||
values: Vec::new(),
|
|
||||||
continuations: None,
|
|
||||||
|
|
||||||
is_continuation: false,
|
|
||||||
is_encoded_attribute: false,
|
|
||||||
is_lower_case: true,
|
|
||||||
is_token_start: true,
|
|
||||||
is_escaped: 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
|
|
||||||
{
|
{
|
||||||
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' => {
|
|
||||||
match parser.state {
|
if self.attr_position > 0 {
|
||||||
ContentState::Type | ContentState::AttributeName | ContentState::SubType => {
|
let continuation = (attr_name, self.attr_position, value);
|
||||||
add_attribute(&mut parser, stream);
|
if let Some(continuations) = self.continuations.as_mut() {
|
||||||
}
|
continuations.push(continuation);
|
||||||
ContentState::AttributeValue | ContentState::AttributeQuotedValue => {
|
} else {
|
||||||
add_value(&mut parser, stream);
|
self.continuations = Some(vec![continuation]);
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match stream.data.get(stream.pos) {
|
self.attr_position = 0;
|
||||||
Some(b' ' | b'\t') => {
|
} else {
|
||||||
|
self.attributes.push((attr_name, value));
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
*old_value = format!("{old_value}{value}").into();
|
||||||
|
} else {
|
||||||
|
self.attributes.push((key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
parser.add_attribute(self);
|
||||||
|
}
|
||||||
|
ContentState::AttributeValue => {
|
||||||
|
parser.add_value(self);
|
||||||
|
}
|
||||||
|
ContentState::AttributeQuotedValue => {
|
||||||
|
if next_is_space {
|
||||||
|
parser.remove_crlf = true;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
parser.add_value(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
|
if next_is_space {
|
||||||
parser.state = ContentState::AttributeName;
|
parser.state = ContentState::AttributeName;
|
||||||
stream.pos += 1;
|
self.next();
|
||||||
iter.next();
|
|
||||||
|
|
||||||
if !parser.is_token_start {
|
if !parser.is_token_start {
|
||||||
parser.is_token_start = true;
|
parser.is_token_start = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
_ => {
|
|
||||||
if parser.continuations.is_some() {
|
if parser.continuations.is_some() {
|
||||||
merge_continuations(&mut parser);
|
parser.merge_continuations();
|
||||||
}
|
}
|
||||||
|
|
||||||
return if let Some(content_type) = parser.c_type {
|
return if let Some(content_type) = parser.c_type {
|
||||||
@@ -341,172 +355,186 @@ pub fn parse_content_type<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
b'/' if parser.state == ContentState::Type => {
|
||||||
b'/' if parser.state == ContentState::Type => {
|
parser.add_attribute(self);
|
||||||
add_attribute(&mut parser, stream);
|
parser.state = ContentState::SubType;
|
||||||
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;
|
continue;
|
||||||
}
|
}
|
||||||
ContentState::AttributeValue => {
|
b';' => match parser.state {
|
||||||
if !parser.is_escaped {
|
ContentState::Type | ContentState::SubType | ContentState::AttributeName => {
|
||||||
add_value(&mut parser, stream);
|
parser.add_attribute(self);
|
||||||
parser.state = ContentState::AttributeName;
|
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 {
|
} else {
|
||||||
parser.is_escaped = false;
|
// Malformed data, reset parser.
|
||||||
|
parser.reset_parser();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_ => (),
|
b'=' => match parser.state {
|
||||||
},
|
ContentState::AttributeName => {
|
||||||
b'*' if parser.state == ContentState::AttributeName => {
|
if !parser.is_continuation {
|
||||||
if !parser.is_continuation {
|
if !parser.add_attribute(self) {
|
||||||
parser.is_continuation = add_attribute(&mut parser, stream);
|
continue;
|
||||||
} else if !parser.is_encoded_attribute {
|
}
|
||||||
add_attr_position(&mut parser, stream);
|
} else if !parser.is_encoded_attribute {
|
||||||
parser.is_encoded_attribute = true;
|
/* If is_continuation=true && is_encoded_attribute=false,
|
||||||
} else {
|
the last character was a '*' which means encoding */
|
||||||
// Malformed data, reset parser.
|
parser.is_encoded_attribute = !parser.add_attr_position(self);
|
||||||
reset_parser(&mut parser);
|
} else {
|
||||||
}
|
parser.reset_parser();
|
||||||
continue;
|
}
|
||||||
}
|
parser.state = ContentState::AttributeValue;
|
||||||
b'=' => match parser.state {
|
continue;
|
||||||
ContentState::AttributeName => {
|
}
|
||||||
if !parser.is_continuation {
|
ContentState::AttributeValue | ContentState::AttributeQuotedValue
|
||||||
if !add_attribute(&mut parser, stream) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
} else if !parser.is_encoded_attribute {
|
self.restore();
|
||||||
/* 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;
|
},
|
||||||
}
|
b'\"' => match parser.state {
|
||||||
ContentState::AttributeValue | ContentState::AttributeQuotedValue
|
ContentState::AttributeValue => {
|
||||||
if parser.is_token_start =>
|
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) =>
|
||||||
{
|
{
|
||||||
if let (d_bytes_read, Some(token)) = decode_rfc2047(stream, stream.pos) {
|
parser.add_attribute_parameter(self);
|
||||||
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;
|
continue;
|
||||||
}
|
}
|
||||||
ContentState::AttributeQuotedValue => {
|
b'(' if parser.state != ContentState::AttributeQuotedValue => {
|
||||||
if !parser.is_escaped {
|
if !parser.is_escaped {
|
||||||
add_value(&mut parser, stream);
|
match parser.state {
|
||||||
parser.state = ContentState::AttributeName;
|
ContentState::Type
|
||||||
continue;
|
| 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 {
|
} else {
|
||||||
parser.is_escaped = false;
|
parser.is_escaped = false;
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
_ => continue,
|
b')' if parser.state == ContentState::Comment => {
|
||||||
},
|
|
||||||
b'\\' => match parser.state {
|
|
||||||
ContentState::AttributeQuotedValue | ContentState::AttributeValue => {
|
|
||||||
if !parser.is_escaped {
|
if !parser.is_escaped {
|
||||||
add_partial_value(&mut parser, stream, true);
|
parser.state = parser.state_stack.pop().unwrap();
|
||||||
parser.is_escaped = true;
|
parser.reset_parser();
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
parser.is_escaped = false;
|
parser.is_escaped = false;
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
ContentState::Comment => parser.is_escaped = !parser.is_escaped,
|
b'\r' => continue,
|
||||||
_ => continue,
|
_ => (),
|
||||||
},
|
|
||||||
b'\''
|
|
||||||
if parser.is_encoded_attribute
|
|
||||||
&& !parser.is_escaped
|
|
||||||
&& (parser.state == ContentState::AttributeValue
|
|
||||||
|| parser.state == ContentState::AttributeQuotedValue) =>
|
|
||||||
{
|
|
||||||
add_attribute_parameter(&mut parser, stream);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
b'(' if parser.state != ContentState::AttributeQuotedValue => {
|
|
||||||
if !parser.is_escaped {
|
|
||||||
match parser.state {
|
|
||||||
ContentState::Type
|
|
||||||
| ContentState::AttributeName
|
|
||||||
| ContentState::SubType => {
|
|
||||||
add_attribute(&mut parser, stream);
|
|
||||||
}
|
|
||||||
ContentState::AttributeValue => {
|
|
||||||
add_value(&mut parser, stream);
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.state_stack.push(parser.state);
|
if parser.is_escaped {
|
||||||
parser.state = ContentState::Comment;
|
parser.is_escaped = false;
|
||||||
} else {
|
|
||||||
parser.is_escaped = false;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
b')' if parser.state == ContentState::Comment => {
|
|
||||||
if !parser.is_escaped {
|
if parser.is_token_start {
|
||||||
parser.state = parser.state_stack.pop().unwrap();
|
parser.is_token_start = false;
|
||||||
reset_parser(&mut parser);
|
}
|
||||||
} else {
|
|
||||||
parser.is_escaped = false;
|
if parser.token_start == 0 {
|
||||||
}
|
parser.token_start = self.offset();
|
||||||
continue;
|
parser.token_end = parser.token_start;
|
||||||
|
} else {
|
||||||
|
parser.token_end = self.offset();
|
||||||
}
|
}
|
||||||
b'\r' => continue,
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if parser.is_escaped {
|
HeaderValue::Empty
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{parsers::message::MessageStream, HeaderValue};
|
use std::{borrow::Cow, collections::HashMap};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||||
|
pub struct ContentTypeMap<'x> {
|
||||||
|
pub c_type: Cow<'x, str>,
|
||||||
|
pub c_subtype: Option<Cow<'x, str>>,
|
||||||
|
pub attributes: Option<HashMap<Cow<'x, str>, Cow<'x, str>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||||
|
pub enum HeaderValueMap<'x> {
|
||||||
|
ContentType(ContentTypeMap<'x>),
|
||||||
|
Empty,
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_content_fields() {
|
fn parse_content_fields() {
|
||||||
use super::parse_content_type;
|
|
||||||
|
|
||||||
let inputs =
|
let inputs =
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
@@ -661,6 +689,17 @@ mod tests {
|
|||||||
" boundary: simple boundary\n"
|
" boundary: simple boundary\n"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"multipart/mixed; boundary=\"foo\n bar\"\n",
|
||||||
|
concat!(
|
||||||
|
"---\n",
|
||||||
|
"ContentType:\n",
|
||||||
|
" c_type: multipart\n",
|
||||||
|
" c_subtype: mixed\n",
|
||||||
|
" attributes:\n",
|
||||||
|
" boundary: \"foo bar\"\n"
|
||||||
|
),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"multipart/alternative; boundary=boundary42\n",
|
"multipart/alternative; boundary=boundary42\n",
|
||||||
concat!(
|
concat!(
|
||||||
@@ -1103,7 +1142,7 @@ mod tests {
|
|||||||
" c_type: inva\n",
|
" c_type: inva\n",
|
||||||
" c_subtype: lid\n",
|
" c_subtype: lid\n",
|
||||||
" attributes:\n",
|
" attributes:\n",
|
||||||
" name: \" \"\n"
|
" name: \" \"\n"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -1115,7 +1154,7 @@ mod tests {
|
|||||||
" c_subtype: lid\n",
|
" c_subtype: lid\n",
|
||||||
" attributes:\n",
|
" attributes:\n",
|
||||||
" test: test\n",
|
" test: test\n",
|
||||||
" name: \" \"\n"
|
" name: \" \"\n"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -1523,8 +1562,18 @@ mod tests {
|
|||||||
for input in inputs {
|
for input in inputs {
|
||||||
let str = input.0.to_string();
|
let str = input.0.to_string();
|
||||||
|
|
||||||
let result = parse_content_type(&mut MessageStream::new(str.as_bytes()));
|
// TODO: Redo tests without using hashmaps.
|
||||||
let expected: HeaderValue = serde_yaml::from_str(input.1).unwrap_or(HeaderValue::Empty);
|
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,
|
||||||
|
attributes: ct.attributes.map(|a| a.into_iter().collect()),
|
||||||
|
}),
|
||||||
|
HeaderValue::Empty => HeaderValueMap::Empty,
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
let expected: HeaderValueMap =
|
||||||
|
serde_yaml::from_str(input.1).unwrap_or(HeaderValueMap::Empty);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if input.0.len() >= 70 {
|
if input.0.len() >= 70 {
|
||||||
|
|||||||
+460
-148
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -11,168 +11,434 @@
|
|||||||
|
|
||||||
use std::fmt;
|
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 {
|
impl DateTime {
|
||||||
/// Returns an ISO-8601 representation of the parsed RFC5322 datetime field
|
/// Parses an RFC822 date
|
||||||
pub fn to_iso8601(&self) -> String {
|
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!(
|
format!(
|
||||||
"{:04}-{:02}-{:02}T{:02}:{:02}:{:02}{}{:02}:{:02}",
|
"{}, {} {} {:04} {:02}:{:02}:{:02} {}{:02}{:02}",
|
||||||
self.year,
|
DOW[self.day_of_week() as usize],
|
||||||
self.month,
|
|
||||||
self.day,
|
self.day,
|
||||||
|
MONTH
|
||||||
|
.get(self.month.saturating_sub(1) as usize)
|
||||||
|
.unwrap_or(&""),
|
||||||
|
self.year,
|
||||||
self.hour,
|
self.hour,
|
||||||
self.minute,
|
self.minute,
|
||||||
self.second,
|
self.second,
|
||||||
if self.tz_before_gmt { "-" } else { "+" },
|
if self.tz_before_gmt && (self.tz_hour > 0 || self.tz_minute > 0) {
|
||||||
|
"-"
|
||||||
|
} else {
|
||||||
|
"+"
|
||||||
|
},
|
||||||
self.tz_hour,
|
self.tz_hour,
|
||||||
self.tz_minute
|
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 {
|
||||||
|
format!(
|
||||||
|
"{:04}-{:02}-{:02}T{:02}:{:02}:{:02}{}{:02}:{:02}",
|
||||||
|
self.year,
|
||||||
|
self.month,
|
||||||
|
self.day,
|
||||||
|
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
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!(
|
||||||
|
"{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",
|
||||||
|
self.year, self.month, self.day, self.hour, self.minute, self.second,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if the date is valid
|
||||||
|
pub fn is_valid(&self) -> bool {
|
||||||
|
(0..=23).contains(&self.tz_hour)
|
||||||
|
&& (1900..=3000).contains(&self.year)
|
||||||
|
&& (0..=59).contains(&self.tz_minute)
|
||||||
|
&& (1..=12).contains(&self.month)
|
||||||
|
&& (1..=31).contains(&self.day)
|
||||||
|
&& (0..=23).contains(&self.hour)
|
||||||
|
&& (0..=59).contains(&self.minute)
|
||||||
|
&& (0..=59).contains(&self.second)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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 = 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;
|
||||||
|
let leap_days = y_adj / 4 - y_adj / 100 + y_adj / 400;
|
||||||
|
(y_adj * 365 + leap_days + month_days as i64 + (self.day as i64 - 1) - 2472632) * 86400
|
||||||
|
+ self.hour as i64 * 3600
|
||||||
|
+ self.minute as i64 * 60
|
||||||
|
+ self.second as i64
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for DateTime {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
self.cmp(other).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ord for DateTime {
|
||||||
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
|
match self.to_timestamp() - other.to_timestamp() {
|
||||||
|
0 => std::cmp::Ordering::Equal,
|
||||||
|
x if x > 0 => std::cmp::Ordering::Greater,
|
||||||
|
_ => std::cmp::Ordering::Less,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for DateTime {
|
impl fmt::Display for DateTime {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt.write_str(&self.to_iso8601())
|
fmt.write_str(&self.to_rfc3339())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_date<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
|
impl<'x> MessageStream<'x> {
|
||||||
let mut pos = 0;
|
pub fn parse_date(&mut self) -> HeaderValue<'x> {
|
||||||
let mut parts = [0u32; 7];
|
let mut pos = 0;
|
||||||
let mut parts_sizes = [
|
let mut parts = [0u32; 7];
|
||||||
2u32, // Day (0)
|
let mut parts_sizes = [
|
||||||
2u32, // Month (1)
|
2u32, // Day (0)
|
||||||
4u32, // Year (2)
|
2u32, // Month (1)
|
||||||
2u32, // Hour (3)
|
4u32, // Year (2)
|
||||||
2u32, // Minute (4)
|
2u32, // Hour (3)
|
||||||
2u32, // Second (5)
|
2u32, // Minute (4)
|
||||||
4u32, // TZ (6)
|
2u32, // Second (5)
|
||||||
];
|
4u32, // TZ (6)
|
||||||
let mut month_hash: usize = 0;
|
];
|
||||||
let mut month_pos: usize = 0;
|
let mut month_hash: usize = 0;
|
||||||
|
let mut month_pos: usize = 0;
|
||||||
|
|
||||||
let mut is_plus = true;
|
let mut is_plus = true;
|
||||||
let mut is_new_token = true;
|
let mut is_new_token = true;
|
||||||
let mut ignore = true;
|
let mut ignore = true;
|
||||||
let mut comment_count = 0;
|
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() {
|
match ch {
|
||||||
let mut next_part = false;
|
b'\n' => {
|
||||||
stream.pos += 1;
|
if self.try_next_is_space() {
|
||||||
|
if !is_new_token && !ignore && comment_count == 0 {
|
||||||
match ch {
|
next_part = true;
|
||||||
b'\n' => match stream.data.get(stream.pos) {
|
} else {
|
||||||
Some(b' ' | b'\t') => {
|
continue;
|
||||||
iter.next();
|
}
|
||||||
stream.pos += 1;
|
|
||||||
|
|
||||||
if !is_new_token && !ignore && comment_count == 0 {
|
|
||||||
next_part = true;
|
|
||||||
} else {
|
} else {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => break,
|
_ if comment_count > 0 => {
|
||||||
},
|
if *ch == b')' {
|
||||||
_ if comment_count > 0 => {
|
comment_count -= 1;
|
||||||
if *ch == b')' {
|
} else if *ch == b'(' {
|
||||||
comment_count -= 1;
|
comment_count += 1;
|
||||||
} else if *ch == b'(' {
|
} 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;
|
comment_count += 1;
|
||||||
} else if *ch == b'\\' {
|
is_new_token = true;
|
||||||
if let Some(b')') = stream.data.get(stream.pos) {
|
continue;
|
||||||
stream.pos += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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 {
|
if pos < 7 && parts_sizes[pos] > 0 {
|
||||||
parts_sizes[pos] -= 1;
|
parts[pos] /= u32::pow(10, parts_sizes[pos]);
|
||||||
parts[pos] += (*ch - b'0') as u32 * u32::pow(10, parts_sizes[pos]);
|
|
||||||
|
|
||||||
if ignore {
|
|
||||||
ignore = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if is_new_token {
|
pos += 1;
|
||||||
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;
|
|
||||||
is_new_token = true;
|
is_new_token = true;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
b',' | b'\r' => (),
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if next_part {
|
if pos >= 6 {
|
||||||
if pos < 7 && parts_sizes[pos] > 0 {
|
HeaderValue::DateTime(DateTime {
|
||||||
parts[pos] /= u32::pow(10, parts_sizes[pos]);
|
year: if (1..=99).contains(&parts[2]) {
|
||||||
}
|
parts[2] + 1900
|
||||||
pos += 1;
|
} else {
|
||||||
is_new_token = true;
|
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]
|
|
||||||
},
|
|
||||||
month: if month_pos == 3 && month_hash <= 30 {
|
|
||||||
MONTH_MAP[month_hash] as u32
|
|
||||||
} else {
|
|
||||||
parts[1]
|
|
||||||
},
|
|
||||||
day: parts[0],
|
|
||||||
hour: parts[3],
|
|
||||||
minute: parts[4],
|
|
||||||
second: parts[5],
|
|
||||||
tz_hour: parts[6] / 100,
|
|
||||||
tz_minute: parts[6] % 100,
|
|
||||||
tz_before_gmt: !is_plus,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
HeaderValue::Empty
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MONTH_HASH: &[u8] = &[
|
static MONTH_HASH: &[u8] = &[
|
||||||
@@ -195,37 +461,40 @@ pub static MONTH_MAP: &[u8; 31] = &[
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use chrono::{FixedOffset, LocalResult, SecondsFormat, TimeZone, Utc};
|
||||||
parsers::{fields::date::parse_date, message::MessageStream},
|
|
||||||
HeaderValue,
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_dates() {
|
fn parse_dates() {
|
||||||
let inputs = [
|
let inputs = [
|
||||||
(
|
(
|
||||||
"Fri, 21 Nov 1997 09:55:06 -0600",
|
"Tue, 1 Jul 2003 10:52:37 +0200",
|
||||||
"1997-11-21T09:55:06-06:00",
|
"2003-07-01T10:52:37+02:00",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Tue, 1 Jul 2003 10:52:37 +0200",
|
"Tue, 1 Jul 2003 10:52:37 +0200",
|
||||||
"2003-07-01T10:52:37+02:00",
|
"2003-07-01T10:52:37+02:00",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Thu, 13 Feb 1969 23:32:54 -0330",
|
"Fri, 21 Nov 1997 09:55:06 -0600",
|
||||||
"1969-02-13T23:32:54-03:30",
|
"1997-11-21T09:55:06-06:00",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Mon, 24 Nov 1997 14:22:01 -0800",
|
"Mon, 24 Nov 1997 14:22:01 -0800",
|
||||||
"1997-11-24T14:22:01-08:00",
|
"1997-11-24T14:22:01-08:00",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Thu,\n 13\n Feb\n 1969\n 23:32\n -0330 (Newfoundland Time)\n",
|
"Tue, 30 Dec 1969 23:32:54 -0330",
|
||||||
"1969-02-13T23:32:00-03:30",
|
"1969-12-30T23:32:54-03:30",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Tue, 1 Jul 2003 10:52:37 +0200",
|
"Thu, 13 Feb 1969 23:32:54 -0330",
|
||||||
"2003-07-01T10:52:37+02:00",
|
"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",
|
" 1 Jul 2003 (comment about date) 10:52:37 +0200",
|
||||||
@@ -235,7 +504,7 @@ mod tests {
|
|||||||
"Tue, 1 Jul 2003 ((tricky)\n comment) 10:52:37 +0200",
|
"Tue, 1 Jul 2003 ((tricky)\n comment) 10:52:37 +0200",
|
||||||
"2003-07-01T10:52:37+02:00",
|
"2003-07-01T10:52:37+02:00",
|
||||||
),
|
),
|
||||||
("21 Nov 97 09:55:06 GMT", "1997-11-21T09:55:06+00:00"),
|
("21 Nov 97 09:55:06 GMT", "1997-11-21T09:55:06Z"),
|
||||||
(
|
(
|
||||||
"20 11 (some \n 44 comments(more comments\n )) 79 05:34:27 -0300",
|
"20 11 (some \n 44 comments(more comments\n )) 79 05:34:27 -0300",
|
||||||
"1979-11-20T05:34:27-03:00",
|
"1979-11-20T05:34:27-03:00",
|
||||||
@@ -260,18 +529,61 @@ mod tests {
|
|||||||
("11 nov 2021 09:55:06 +0200", "2021-11-11T09:55:06+02:00"),
|
("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"),
|
("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"),
|
("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 in inputs {
|
for (pos, (input, expected_result)) in inputs.iter().enumerate() {
|
||||||
let str = input.0.to_string();
|
match MessageStream::new(input.as_bytes()).parse_date() {
|
||||||
match parse_date(&mut MessageStream::new(str.as_bytes())) {
|
HeaderValue::DateTime(datetime) => {
|
||||||
HeaderValue::DateTime(date) => {
|
if pos < 6 {
|
||||||
//println!("{} -> {}", input.0.escape_debug(), date.to_iso8601());
|
assert_eq!(*input, datetime.to_rfc822());
|
||||||
assert_eq!(input.1, date.to_iso8601());
|
}
|
||||||
|
assert_eq!(*expected_result, datetime.to_rfc3339());
|
||||||
|
|
||||||
|
if datetime.is_valid() {
|
||||||
|
if let LocalResult::Single(chrono_datetime)
|
||||||
|
| LocalResult::Ambiguous(chrono_datetime, _) = FixedOffset::west_opt(
|
||||||
|
((datetime.tz_hour as i32 * 3600i32) + datetime.tz_minute as i32 * 60)
|
||||||
|
* if datetime.tz_before_gmt { 1i32 } else { -1i32 },
|
||||||
|
)
|
||||||
|
.unwrap_or_else(|| FixedOffset::east(0))
|
||||||
|
.ymd_opt(
|
||||||
|
datetime.year as i32,
|
||||||
|
datetime.month as u32,
|
||||||
|
datetime.day as u32,
|
||||||
|
)
|
||||||
|
.and_hms_opt(
|
||||||
|
datetime.hour as u32,
|
||||||
|
datetime.minute as u32,
|
||||||
|
datetime.second as u32,
|
||||||
|
) {
|
||||||
|
assert_eq!(
|
||||||
|
chrono_datetime.timestamp(),
|
||||||
|
datetime.to_timestamp(),
|
||||||
|
"{} -> {} ({}) -> {} ({})",
|
||||||
|
input.escape_debug(),
|
||||||
|
datetime.to_timestamp(),
|
||||||
|
Utc.timestamp_opt(datetime.to_timestamp(), 0)
|
||||||
|
.unwrap()
|
||||||
|
.to_rfc3339_opts(SecondsFormat::Secs, true),
|
||||||
|
chrono_datetime.timestamp(),
|
||||||
|
Utc.timestamp_opt(chrono_datetime.timestamp(), 0)
|
||||||
|
.unwrap()
|
||||||
|
.to_rfc3339_opts(SecondsFormat::Secs, true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HeaderValue::Empty => {
|
HeaderValue::Empty => {
|
||||||
//println!("{} -> None", input.0.escape_debug());
|
//println!("{} -> None", input.0.escape_debug());
|
||||||
assert!(input.1.is_empty());
|
assert!(expected_result.is_empty());
|
||||||
}
|
}
|
||||||
_ => panic!("Unexpected result"),
|
_ => panic!("Unexpected result"),
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-51
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,67 +9,75 @@
|
|||||||
* except according to those terms.
|
* 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> {
|
impl<'x> MessageStream<'x> {
|
||||||
let mut token_start: usize = 0;
|
pub fn parse_id(&mut self) -> HeaderValue<'x> {
|
||||||
let mut token_end: usize = 0;
|
let mut token_start: usize = 0;
|
||||||
let mut is_id_part = false;
|
let mut token_end: usize = 0;
|
||||||
let mut ids = Vec::new();
|
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) = self.next() {
|
||||||
|
match ch {
|
||||||
while let Some(ch) = iter.next() {
|
b'\n' => {
|
||||||
stream.pos += 1;
|
if !self.try_next_is_space() {
|
||||||
match ch {
|
return match ids.len() {
|
||||||
b'\n' => match stream.data.get(stream.pos) {
|
1 => HeaderValue::Text(ids.pop().unwrap()),
|
||||||
Some(b' ' | b'\t') => {
|
0 => {
|
||||||
iter.next();
|
if token_invalid_start > 0 {
|
||||||
stream.pos += 1;
|
HeaderValue::Text(String::from_utf8_lossy(
|
||||||
|
self.bytes(token_invalid_start - 1..token_invalid_end),
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
HeaderValue::Empty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => HeaderValue::TextList(ids),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b'<' => {
|
||||||
|
is_id_part = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_ => {
|
b'>' => {
|
||||||
return match ids.len() {
|
is_id_part = false;
|
||||||
1 => HeaderValue::Text(ids.pop().unwrap()),
|
if token_start > 0 {
|
||||||
0 => HeaderValue::Empty,
|
ids.push(String::from_utf8_lossy(
|
||||||
_ => HeaderValue::TextList(ids),
|
self.bytes(token_start - 1..token_end),
|
||||||
};
|
));
|
||||||
|
token_start = 0;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
b' ' | b'\t' | b'\r' => continue,
|
||||||
b'<' => {
|
_ => {}
|
||||||
is_id_part = true;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
b'>' => {
|
if is_id_part {
|
||||||
is_id_part = false;
|
if token_start == 0 {
|
||||||
if token_start > 0 {
|
token_start = self.offset();
|
||||||
ids.push(String::from_utf8_lossy(
|
|
||||||
&stream.data[token_start - 1..token_end],
|
|
||||||
));
|
|
||||||
token_start = 0;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
token_end = self.offset();
|
||||||
|
} else {
|
||||||
|
if token_invalid_start == 0 {
|
||||||
|
token_invalid_start = self.offset();
|
||||||
|
}
|
||||||
|
token_invalid_end = self.offset();
|
||||||
}
|
}
|
||||||
b' ' | b'\t' | b'\r' => continue,
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
if is_id_part {
|
|
||||||
if token_start == 0 {
|
|
||||||
token_start = stream.pos;
|
|
||||||
}
|
|
||||||
token_end = stream.pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeaderValue::Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderValue::Empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::parsers::fields::id::parse_id;
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
use crate::parsers::message::MessageStream;
|
|
||||||
use crate::HeaderValue;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_message_ids() {
|
fn parse_message_ids() {
|
||||||
@@ -102,11 +110,22 @@ mod tests {
|
|||||||
"<1234 @ local(blah) .machine .example>\n",
|
"<1234 @ local(blah) .machine .example>\n",
|
||||||
vec!["1234 @ local(blah) .machine .example"],
|
vec!["1234 @ local(blah) .machine .example"],
|
||||||
),
|
),
|
||||||
|
("<>\n", vec![""]),
|
||||||
|
// Malformed Ids should be parsed anyway
|
||||||
|
(
|
||||||
|
"malformed@id.machine.example\n",
|
||||||
|
vec!["malformed@id.machine.example"],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
" malformed2@id.machine.example \t \n",
|
||||||
|
vec!["malformed2@id.machine.example"],
|
||||||
|
),
|
||||||
|
(" m \n", vec!["m"]),
|
||||||
];
|
];
|
||||||
|
|
||||||
for input in inputs {
|
for input in inputs {
|
||||||
let str = input.0.to_string();
|
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) => {
|
HeaderValue::TextList(ids) => {
|
||||||
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
|
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
|
||||||
}
|
}
|
||||||
@@ -114,7 +133,8 @@ mod tests {
|
|||||||
assert!(input.1.len() == 1, "Failed to parse '{:?}'", input.0);
|
assert!(input.1.len() == 1, "Failed to parse '{:?}'", input.0);
|
||||||
assert_eq!(id, input.1[0], "Failed to parse '{:?}'", input.0);
|
assert_eq!(id, input.1[0], "Failed to parse '{:?}'", input.0);
|
||||||
}
|
}
|
||||||
_ => panic!("Unexpected result"),
|
HeaderValue::Empty if input.1[0].is_empty() => {}
|
||||||
|
result => panic!("Unexpected result: {:?}", result),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-89
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, HeaderValue};
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
|
|
||||||
struct ListParser<'x> {
|
struct ListParser<'x> {
|
||||||
token_start: usize,
|
token_start: usize,
|
||||||
@@ -21,116 +21,105 @@ struct ListParser<'x> {
|
|||||||
list: Vec<Cow<'x, str>>,
|
list: Vec<Cow<'x, str>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_token<'x>(parser: &mut ListParser<'x>, stream: &MessageStream<'x>, add_space: bool) {
|
impl<'x> ListParser<'x> {
|
||||||
if parser.token_start > 0 {
|
fn add_token(&mut self, stream: &MessageStream<'x>, add_space: bool) {
|
||||||
if !parser.tokens.is_empty() {
|
if self.token_start > 0 {
|
||||||
parser.tokens.push(" ".into());
|
if !self.tokens.is_empty() {
|
||||||
}
|
self.tokens.push(" ".into());
|
||||||
parser.tokens.push(String::from_utf8_lossy(
|
}
|
||||||
&stream.data[parser.token_start - 1..parser.token_end],
|
self.tokens.push(String::from_utf8_lossy(
|
||||||
));
|
&stream.data[self.token_start - 1..self.token_end],
|
||||||
|
));
|
||||||
|
|
||||||
if add_space {
|
if add_space {
|
||||||
parser.tokens.push(" ".into());
|
self.tokens.push(" ".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.token_start = 0;
|
self.token_start = 0;
|
||||||
parser.is_token_start = true;
|
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) {
|
impl<'x> MessageStream<'x> {
|
||||||
if !parser.tokens.is_empty() {
|
pub fn parse_comma_separared(&mut self) -> HeaderValue<'x> {
|
||||||
parser.list.push(if parser.tokens.len() == 1 {
|
let mut parser = ListParser {
|
||||||
parser.tokens.pop().unwrap()
|
token_start: 0,
|
||||||
} else {
|
token_end: 0,
|
||||||
let value = parser.tokens.concat();
|
is_token_start: true,
|
||||||
parser.tokens.clear();
|
tokens: Vec::new(),
|
||||||
value.into()
|
list: Vec::new(),
|
||||||
});
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_comma_separared<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
|
while let Some(ch) = self.next() {
|
||||||
let mut parser = ListParser {
|
match ch {
|
||||||
token_start: 0,
|
b'\n' => {
|
||||||
token_end: 0,
|
parser.add_token(self, false);
|
||||||
is_token_start: true,
|
if !self.try_next_is_space() {
|
||||||
tokens: Vec::new(),
|
parser.add_tokens_to_list();
|
||||||
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);
|
|
||||||
|
|
||||||
return match parser.list.len() {
|
return match parser.list.len() {
|
||||||
1 => HeaderValue::Text(parser.list.pop().unwrap()),
|
1 => HeaderValue::Text(parser.list.pop().unwrap()),
|
||||||
0 => HeaderValue::Empty,
|
0 => HeaderValue::Empty,
|
||||||
_ => HeaderValue::TextList(parser.list),
|
_ => HeaderValue::TextList(parser.list),
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
b' ' | b'\t' => {
|
||||||
b' ' | b'\t' => {
|
if !parser.is_token_start {
|
||||||
if !parser.is_token_start {
|
parser.is_token_start = true;
|
||||||
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();
|
|
||||||
continue;
|
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);
|
if parser.is_token_start {
|
||||||
add_tokens_to_list(&mut parser);
|
parser.is_token_start = false;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
b'\r' => continue,
|
|
||||||
_ => (),
|
if parser.token_start == 0 {
|
||||||
|
parser.token_start = self.offset();
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.token_end = self.offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if parser.is_token_start {
|
HeaderValue::Empty
|
||||||
parser.is_token_start = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if parser.token_start == 0 {
|
|
||||||
parser.token_start = stream.pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.token_end = stream.pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderValue::Empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::parsers::fields::list::parse_comma_separared;
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
use crate::parsers::message::MessageStream;
|
|
||||||
use crate::HeaderValue;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_comma_separated_text() {
|
fn parse_comma_separated_text() {
|
||||||
@@ -174,7 +163,7 @@ mod tests {
|
|||||||
for input in inputs {
|
for input in inputs {
|
||||||
let str = input.0.to_string();
|
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) => {
|
HeaderValue::TextList(ids) => {
|
||||||
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
|
assert_eq!(ids, input.1, "Failed to parse '{:?}'", input.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
|||||||
+69
-51
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,61 +9,46 @@
|
|||||||
* except according to those terms.
|
* 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> {
|
impl<'x> MessageStream<'x> {
|
||||||
let mut token_start: usize = 0;
|
pub fn parse_raw(&mut self) -> HeaderValue<'x> {
|
||||||
let mut token_end: usize = 0;
|
let mut token_start: usize = 0;
|
||||||
|
let mut token_end: usize = 0;
|
||||||
|
|
||||||
let mut iter = stream.data[stream.pos..].iter();
|
while let Some(ch) = self.next() {
|
||||||
|
match ch {
|
||||||
while let Some(ch) = iter.next() {
|
b'\n' => {
|
||||||
stream.pos += 1;
|
if !self.try_next_is_space() {
|
||||||
match ch {
|
return if token_start > 0 {
|
||||||
b'\n' => match stream.data.get(stream.pos) {
|
HeaderValue::Text(String::from_utf8_lossy(
|
||||||
Some(b' ' | b'\t') => {
|
self.bytes(token_start - 1..token_end),
|
||||||
iter.next();
|
))
|
||||||
stream.pos += 1;
|
} else {
|
||||||
continue;
|
HeaderValue::Empty
|
||||||
}
|
};
|
||||||
_ => {
|
|
||||||
return if token_start > 0 {
|
|
||||||
HeaderValue::Text(String::from_utf8_lossy(
|
|
||||||
&stream.data[token_start - 1..token_end],
|
|
||||||
))
|
|
||||||
} else {
|
} 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 {
|
HeaderValue::Empty
|
||||||
token_start = stream.pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
token_end = stream.pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderValue::Empty
|
pub fn parse_and_ignore(&mut self) {
|
||||||
}
|
while let Some(&ch) = self.next() {
|
||||||
|
if ch == b'\n' && !self.try_next_is_space() {
|
||||||
pub fn parse_and_ignore(stream: &mut MessageStream) {
|
break;
|
||||||
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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,8 +56,7 @@ pub fn parse_and_ignore(stream: &mut MessageStream) {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::parsers::fields::raw::parse_raw;
|
use crate::{parsers::MessageStream, Message};
|
||||||
use crate::parsers::message::MessageStream;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_raw_text() {
|
fn parse_raw_text() {
|
||||||
@@ -96,11 +80,45 @@ mod tests {
|
|||||||
for input in inputs {
|
for input in inputs {
|
||||||
let str = input.0.to_string();
|
let str = input.0.to_string();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_raw(&mut MessageStream::new(str.as_bytes())).unwrap_text(),
|
MessageStream::new(str.as_bytes()).parse_raw().unwrap_text(),
|
||||||
input.1,
|
input.1,
|
||||||
"Failed for '{:?}'",
|
"Failed for '{:?}'",
|
||||||
input.0
|
input.0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ordered_raw_headers() {
|
||||||
|
let input = br#"From: Art Vandelay <art@vandelay.com>
|
||||||
|
To: jane@example.com
|
||||||
|
Date: Sat, 20 Nov 2021 14:22:01 -0800
|
||||||
|
Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?=
|
||||||
|
Content-Type: multipart/mixed; boundary="festivus";
|
||||||
|
|
||||||
|
Here's a message body.
|
||||||
|
"#;
|
||||||
|
let message = Message::parse(input).unwrap();
|
||||||
|
let mut iter = message.headers_raw();
|
||||||
|
assert_eq!(
|
||||||
|
iter.next().unwrap(),
|
||||||
|
("From", " Art Vandelay <art@vandelay.com>\n")
|
||||||
|
);
|
||||||
|
assert_eq!(iter.next().unwrap(), ("To", " jane@example.com\n"));
|
||||||
|
assert_eq!(
|
||||||
|
iter.next().unwrap(),
|
||||||
|
("Date", " Sat, 20 Nov 2021 14:22:01 -0800\n")
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
iter.next().unwrap(),
|
||||||
|
(
|
||||||
|
"Subject",
|
||||||
|
" Why not both importing AND exporting? =?utf-8?b?4pi6?=\n"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
iter.next().unwrap(),
|
||||||
|
("Content-Type", " multipart/mixed; boundary=\"festivus\";\n")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -275,7 +275,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for (input, expected) in 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 {
|
for (input, expected) in tests {
|
||||||
assert_eq!(trim_trailing_fwd(input), expected, "{:?}", input);
|
assert_eq!(trim_trailing_fwd(input), expected, "{input:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -11,106 +11,94 @@
|
|||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::{decoders::encoded_word::decode_rfc2047, parsers::message::MessageStream, HeaderValue};
|
use crate::{parsers::MessageStream, HeaderValue};
|
||||||
struct UnstructuredParser<'x> {
|
struct UnstructuredParser<'x> {
|
||||||
token_start: usize,
|
token_start: usize,
|
||||||
token_end: usize,
|
token_end: usize,
|
||||||
is_token_start: bool,
|
|
||||||
tokens: Vec<Cow<'x, str>>,
|
tokens: Vec<Cow<'x, str>>,
|
||||||
|
last_is_encoded: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_token<'x>(parser: &mut UnstructuredParser<'x>, stream: &MessageStream<'x>, add_space: bool) {
|
impl<'x> UnstructuredParser<'x> {
|
||||||
if parser.token_start > 0 {
|
fn add_token(&mut self, stream: &MessageStream<'x>) {
|
||||||
if !parser.tokens.is_empty() {
|
if self.token_start > 0 {
|
||||||
parser.tokens.push(" ".into());
|
if !self.tokens.is_empty() {
|
||||||
}
|
self.tokens.push(" ".into());
|
||||||
parser.tokens.push(String::from_utf8_lossy(
|
}
|
||||||
&stream.data[parser.token_start - 1..parser.token_end],
|
self.tokens.push(String::from_utf8_lossy(
|
||||||
));
|
stream.bytes(self.token_start - 1..self.token_end),
|
||||||
|
));
|
||||||
|
|
||||||
if add_space {
|
self.token_start = 0;
|
||||||
parser.tokens.push(" ".into());
|
self.last_is_encoded = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parser.token_start = 0;
|
fn add_rfc2047(&mut self, token: String) {
|
||||||
parser.is_token_start = true;
|
if !self.last_is_encoded {
|
||||||
|
self.tokens.push(" ".into());
|
||||||
|
}
|
||||||
|
self.tokens.push(token.into());
|
||||||
|
self.last_is_encoded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_unstructured<'x>(stream: &mut MessageStream<'x>) -> HeaderValue<'x> {
|
impl<'x> MessageStream<'x> {
|
||||||
let mut parser = UnstructuredParser {
|
pub fn parse_unstructured(&mut self) -> HeaderValue<'x> {
|
||||||
token_start: 0,
|
let mut parser = UnstructuredParser {
|
||||||
token_end: 0,
|
token_start: 0,
|
||||||
is_token_start: true,
|
token_end: 0,
|
||||||
tokens: Vec::new(),
|
tokens: Vec::new(),
|
||||||
};
|
last_is_encoded: true,
|
||||||
|
};
|
||||||
|
|
||||||
let mut iter = stream.data[stream.pos..].iter();
|
while let Some(ch) = self.next() {
|
||||||
|
match ch {
|
||||||
|
b'\n' => {
|
||||||
|
parser.add_token(self);
|
||||||
|
|
||||||
while let Some(ch) = iter.next() {
|
if !self.try_next_is_space() {
|
||||||
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;
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return match parser.tokens.len() {
|
return match parser.tokens.len() {
|
||||||
1 => HeaderValue::Text(parser.tokens.pop().unwrap()),
|
1 => HeaderValue::Text(parser.tokens.pop().unwrap()),
|
||||||
0 => HeaderValue::Empty,
|
0 => HeaderValue::Empty,
|
||||||
_ => HeaderValue::Text(parser.tokens.concat().into()),
|
_ => HeaderValue::Text(parser.tokens.concat().into()),
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
b' ' | b'\t' | b'\r' => {
|
||||||
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();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
b'=' if self.peek_char(b'?') => {
|
||||||
|
self.checkpoint();
|
||||||
|
if let Some(token) = self.decode_rfc2047() {
|
||||||
|
parser.add_token(self);
|
||||||
|
parser.add_rfc2047(token);
|
||||||
|
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 {
|
HeaderValue::Empty
|
||||||
parser.is_token_start = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if parser.token_start == 0 {
|
|
||||||
parser.token_start = stream.pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.token_end = stream.pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderValue::Empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
use crate::parsers::MessageStream;
|
||||||
fn parse_unstructured_text() {
|
|
||||||
use crate::parsers::fields::unstructured::parse_unstructured;
|
|
||||||
use crate::parsers::message::MessageStream;
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_unstructured() {
|
||||||
let inputs = [
|
let inputs = [
|
||||||
("Saying Hello\n", "Saying Hello", true),
|
("Saying Hello\n", "Saying Hello", true),
|
||||||
("Re: Saying Hello\r\n", "Re: Saying Hello", true),
|
("Re: Saying Hello\r\n", "Re: Saying Hello", true),
|
||||||
@@ -178,15 +166,48 @@ mod tests {
|
|||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
("ハロー・ワールド \n", "ハロー・ワールド", true),
|
("ハロー・ワールド \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,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Les Communs - =?utf-8?Q?R=C3=A9capitulatif?= de la\r\n =?utf-8?Q?r=C3=A9servation?= 13510164434879\r\n",
|
||||||
|
"Les Communs - Récapitulatif de la réservation 13510164434879",
|
||||||
|
true,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
for input in inputs {
|
for (input, expected_result, _) in inputs {
|
||||||
let str = input.0.to_string();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_unstructured(&mut MessageStream::new(str.as_bytes()),).unwrap_text(),
|
MessageStream::new(input.as_bytes())
|
||||||
input.1,
|
.parse_unstructured()
|
||||||
"Failed to parse '{:?}'",
|
.unwrap_text(),
|
||||||
input.0
|
expected_result,
|
||||||
|
"Failed to parse '{input:?}'",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+330
-288
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,258 +9,300 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{borrow::Cow, collections::hash_map::Entry};
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::{HeaderName, HeaderOffset, HeaderOffsetName, HeaderValue, OtherHeaders, RfcHeaders};
|
use crate::{Header, HeaderName, RfcHeader};
|
||||||
|
|
||||||
use super::{
|
use super::MessageStream;
|
||||||
fields::{
|
|
||||||
address::parse_address, content_type::parse_content_type, date::parse_date, id::parse_id,
|
|
||||||
list::parse_comma_separared, raw::parse_raw, unstructured::parse_unstructured,
|
|
||||||
},
|
|
||||||
message::MessageStream,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
impl<'x> MessageStream<'x> {
|
||||||
pub enum HeaderParserResult<'x> {
|
pub fn parse_headers(&mut self, headers: &mut Vec<Header<'x>>) -> bool {
|
||||||
Rfc(HeaderName),
|
loop {
|
||||||
Other(Cow<'x, str>),
|
loop {
|
||||||
Lf,
|
match self.peek() {
|
||||||
Eof,
|
Some(b'\n') => {
|
||||||
}
|
self.next();
|
||||||
|
return true;
|
||||||
pub fn parse_headers<'x>(
|
}
|
||||||
headers_rfc: &mut RfcHeaders<'x>,
|
None => return false,
|
||||||
mut headers_other: Option<&mut OtherHeaders<'x>>,
|
Some(ch) if !ch.is_ascii_whitespace() => {
|
||||||
mut headers_offsets: Option<&mut Vec<HeaderOffset<'x>>>,
|
break;
|
||||||
stream: &mut MessageStream<'x>,
|
}
|
||||||
) -> bool {
|
_ => {
|
||||||
loop {
|
self.next();
|
||||||
let (bytes_read, result) = parse_header_name(&stream.data[stream.pos..]);
|
|
||||||
stream.pos += bytes_read;
|
|
||||||
|
|
||||||
match result {
|
|
||||||
HeaderParserResult::Rfc(name) => {
|
|
||||||
let (is_many, parser) = HDR_PARSER[name as usize];
|
|
||||||
|
|
||||||
let from_offset = stream.pos;
|
|
||||||
let value = parser(stream);
|
|
||||||
if let Some(headers_offsets) = headers_offsets.as_mut() {
|
|
||||||
headers_offsets.push(HeaderOffset {
|
|
||||||
name: HeaderOffsetName::Rfc(name),
|
|
||||||
start: from_offset,
|
|
||||||
end: stream.pos,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if !value.is_empty() {
|
|
||||||
if is_many {
|
|
||||||
match headers_rfc.entry(name) {
|
|
||||||
Entry::Occupied(mut e) => {
|
|
||||||
if let HeaderValue::Collection(col) = e.get_mut() {
|
|
||||||
col.push(value);
|
|
||||||
} else {
|
|
||||||
let old_value = e.remove();
|
|
||||||
headers_rfc.insert(
|
|
||||||
name,
|
|
||||||
HeaderValue::Collection(vec![old_value, value]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Entry::Vacant(e) => {
|
|
||||||
e.insert(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
headers_rfc.insert(name, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HeaderParserResult::Other(name) => {
|
|
||||||
if let Some(headers_other) = headers_other.as_mut() {
|
|
||||||
let from_offset = stream.pos;
|
|
||||||
let value = parse_raw(stream);
|
|
||||||
if let Some(headers_offsets) = headers_offsets.as_mut() {
|
|
||||||
headers_offsets.push(HeaderOffset {
|
|
||||||
name: HeaderOffsetName::Other(name.clone()),
|
|
||||||
start: from_offset,
|
|
||||||
end: stream.pos,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if !value.is_empty() {
|
let offset_field = self.offset();
|
||||||
match headers_other.entry(name.clone()) {
|
|
||||||
Entry::Occupied(mut e) => {
|
if let Some(header_name) = self.parse_header_name() {
|
||||||
if let HeaderValue::Collection(col) = e.get_mut() {
|
let from_offset = self.offset();
|
||||||
col.push(value);
|
let value = if let HeaderName::Rfc(rfc_name) = &header_name {
|
||||||
} else {
|
match rfc_name {
|
||||||
let old_value = e.remove();
|
RfcHeader::Subject
|
||||||
headers_other.insert(
|
| RfcHeader::Comments
|
||||||
name,
|
| RfcHeader::ContentDescription
|
||||||
HeaderValue::Collection(vec![old_value, value]),
|
| RfcHeader::ContentLocation
|
||||||
);
|
| RfcHeader::ContentTransferEncoding => self.parse_unstructured(),
|
||||||
}
|
RfcHeader::From
|
||||||
}
|
| RfcHeader::To
|
||||||
Entry::Vacant(e) => {
|
| RfcHeader::Cc
|
||||||
e.insert(value);
|
| 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
self.parse_raw()
|
||||||
HeaderParserResult::Lf => return true,
|
};
|
||||||
HeaderParserResult::Eof => return false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_header_name(data: &[u8]) -> (usize, HeaderParserResult) {
|
headers.push(Header {
|
||||||
let mut token_start: usize = 0;
|
name: header_name,
|
||||||
let mut token_end: usize = 0;
|
value,
|
||||||
let mut token_len: usize = 0;
|
offset_field,
|
||||||
let mut token_hash: usize = 0;
|
offset_start: from_offset,
|
||||||
let mut last_ch: u8 = 0;
|
offset_end: self.offset(),
|
||||||
let mut bytes_read: usize = 0;
|
});
|
||||||
|
} else if self.is_eof() {
|
||||||
for ch in data.iter() {
|
return false;
|
||||||
bytes_read += 1;
|
|
||||||
|
|
||||||
match ch {
|
|
||||||
b':' => {
|
|
||||||
if token_start != 0 {
|
|
||||||
let field = &data[token_start - 1..token_end];
|
|
||||||
|
|
||||||
if (2..=25).contains(&token_len) {
|
|
||||||
token_hash +=
|
|
||||||
token_len + 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]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
bytes_read,
|
|
||||||
HeaderParserResult::Other(String::from_utf8_lossy(field)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
token_len += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(bytes_read, HeaderParserResult::Eof)
|
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;
|
||||||
|
|
||||||
|
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 From<HeaderName> for u8 {
|
impl<'x> HeaderName<'x> {
|
||||||
fn from(name: HeaderName) -> Self {
|
/// 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 data_.eq_ignore_ascii_case(HDR_NAMES[token_hash]) {
|
||||||
|
return HeaderName::Rfc(HDR_MAP[token_hash]).into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !data.is_empty() {
|
||||||
|
HeaderName::Other(data).into()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<RfcHeader> for u8 {
|
||||||
|
fn from(name: RfcHeader) -> Self {
|
||||||
name as u8
|
name as u8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{parsers::header::parse_header_name, HeaderName};
|
use crate::{parsers::MessageStream, HeaderName, RfcHeader};
|
||||||
|
|
||||||
use super::HeaderParserResult;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn header_name_parse() {
|
fn header_name_parse() {
|
||||||
let inputs = [
|
let inputs = [
|
||||||
("From: ", HeaderParserResult::Rfc(HeaderName::From)),
|
("From: ", HeaderName::Rfc(RfcHeader::From)),
|
||||||
("receiVED: ", HeaderParserResult::Rfc(HeaderName::Received)),
|
("receiVED: ", HeaderName::Rfc(RfcHeader::Received)),
|
||||||
(
|
(" subject : ", HeaderName::Rfc(RfcHeader::Subject)),
|
||||||
" subject : ",
|
|
||||||
HeaderParserResult::Rfc(HeaderName::Subject),
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
"X-Custom-Field : ",
|
"X-Custom-Field : ",
|
||||||
HeaderParserResult::Other("X-Custom-Field".into()),
|
HeaderName::Other("X-Custom-Field".into()),
|
||||||
),
|
|
||||||
(" T : ", HeaderParserResult::Other("T".into())),
|
|
||||||
(
|
|
||||||
"mal formed: ",
|
|
||||||
HeaderParserResult::Other("mal formed".into()),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MIME-version : ",
|
|
||||||
HeaderParserResult::Rfc(HeaderName::MimeVersion),
|
|
||||||
),
|
),
|
||||||
|
(" T : ", HeaderName::Other("T".into())),
|
||||||
|
("mal formed: ", HeaderName::Other("mal formed".into())),
|
||||||
|
("MIME-version : ", HeaderName::Rfc(RfcHeader::MimeVersion)),
|
||||||
];
|
];
|
||||||
|
|
||||||
for input in inputs {
|
for (input, expected_result) in inputs {
|
||||||
let str = input.0.to_string();
|
assert_eq!(
|
||||||
let (_, result) = parse_header_name(str.as_bytes());
|
expected_result,
|
||||||
assert_eq!(input.1, result, "Failed to parse '{:?}'", input.0);
|
MessageStream::new(input.as_bytes())
|
||||||
|
.parse_header_name()
|
||||||
|
.unwrap(),
|
||||||
|
"Failed to parse '{input:?}'",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
/*
|
||||||
static HDR_PARSER: &[(
|
type ParserFnc<'x> = fn(&mut MessageStream<'x>) -> HeaderValue<'x>;
|
||||||
bool,
|
|
||||||
for<'x, 'y> 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, parse_unstructured), // Subject = 0,
|
(false, MessageStream::parse_address), // From = 1,
|
||||||
(false, parse_address), // From = 1,
|
(false, MessageStream::parse_address), // To = 2,
|
||||||
(false, parse_address), // To = 2,
|
(false, MessageStream::parse_address), // Cc = 3,
|
||||||
(false, parse_address), // Cc = 3,
|
(false, MessageStream::parse_date), // Date = 4,
|
||||||
(false, parse_date), // Date = 4,
|
(false, MessageStream::parse_address), // Bcc = 5,
|
||||||
(false, parse_address), // Bcc = 5,
|
(false, MessageStream::parse_address), // ReplyTo = 6,
|
||||||
(false, parse_address), // ReplyTo = 6,
|
(false, MessageStream::parse_address), // Sender = 7,
|
||||||
(false, parse_address), // Sender = 7,
|
(true, MessageStream::parse_unstructured), // Comments = 8,
|
||||||
(true, parse_unstructured), // Comments = 8,
|
(false, MessageStream::parse_id), // InReplyTo = 9,
|
||||||
(false, parse_address), // InReplyTo = 9,
|
(true, MessageStream::parse_comma_separared), // Keywords = 10,
|
||||||
(true, parse_comma_separared), // Keywords = 10,
|
(true, MessageStream::parse_raw), // Received = 11,
|
||||||
(true, parse_raw), // Received = 11,
|
(false, MessageStream::parse_id), // MessageId = 12,
|
||||||
(false, parse_id), // MessageId = 12,
|
(true, MessageStream::parse_id), // References = 13, (RFC 5322 recommends One)
|
||||||
(true, parse_id), // References = 13, (RFC 5322 recommends One)
|
(false, MessageStream::parse_id), // ReturnPath = 14,
|
||||||
(false, parse_id), // ReturnPath = 14,
|
(false, MessageStream::parse_raw), // MimeVersion = 15,
|
||||||
(false, parse_raw), // MimeVersion = 15,
|
(false, MessageStream::parse_unstructured), // ContentDescription = 16,
|
||||||
(false, parse_unstructured), // ContentDescription = 16,
|
(false, MessageStream::parse_id), // ContentId = 17,
|
||||||
(false, parse_id), // ContentId = 17,
|
(false, MessageStream::parse_comma_separared), // ContentLanguage = 18
|
||||||
(false, parse_comma_separared), // ContentLanguage = 18
|
(false, MessageStream::parse_unstructured), // ContentLocation = 19
|
||||||
(false, parse_unstructured), // ContentLocation = 19
|
(false, MessageStream::parse_unstructured), // ContentTransferEncoding = 20,
|
||||||
(false, parse_unstructured), // ContentTransferEncoding = 20,
|
(false, MessageStream::parse_content_type), // ContentType = 21,
|
||||||
(false, parse_content_type), // ContentType = 21,
|
(false, MessageStream::parse_content_type), // ContentDisposition = 22,
|
||||||
(false, parse_content_type), // ContentDisposition = 22,
|
(true, MessageStream::parse_address), // ResentTo = 23,
|
||||||
(true, parse_address), // ResentTo = 23,
|
(true, MessageStream::parse_address), // ResentFrom = 24,
|
||||||
(true, parse_address), // ResentFrom = 24,
|
(true, MessageStream::parse_address), // ResentBcc = 25,
|
||||||
(true, parse_address), // ResentBcc = 25,
|
(true, MessageStream::parse_address), // ResentCc = 26,
|
||||||
(true, parse_address), // ResentCc = 26,
|
(true, MessageStream::parse_address), // ResentSender = 27,
|
||||||
(true, parse_address), // ResentSender = 27,
|
(true, MessageStream::parse_date), // ResentDate = 28,
|
||||||
(true, parse_date), // ResentDate = 28,
|
(true, MessageStream::parse_id), // ResentMessageId = 29,
|
||||||
(true, parse_id), // ResentMessageId = 29,
|
(false, MessageStream::parse_address), // ListArchive = 30,
|
||||||
(false, parse_address), // ListArchive = 30,
|
(false, MessageStream::parse_address), // ListHelp = 31,
|
||||||
(false, parse_address), // ListHelp = 31,
|
(false, MessageStream::parse_address), // ListId = 32,
|
||||||
(false, parse_address), // ListId = 32,
|
(false, MessageStream::parse_address), // ListOwner = 33,
|
||||||
(false, parse_address), // ListOwner = 33,
|
(false, MessageStream::parse_address), // ListPost = 34,
|
||||||
(false, parse_address), // ListPost = 34,
|
(false, MessageStream::parse_address), // ListSubscribe = 35,
|
||||||
(false, parse_address), // ListSubscribe = 35,
|
(false, MessageStream::parse_address), // ListUnsubscribe = 36,
|
||||||
(false, parse_address), // ListUnsubscribe = 36,
|
(true, MessageStream::parse_raw), // Other = 37,
|
||||||
(true, parse_raw), // Other = 37,
|
];*/
|
||||||
];
|
|
||||||
|
|
||||||
static HDR_HASH: &[u8] = &[
|
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,
|
73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
||||||
@@ -276,76 +318,76 @@ 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, 73, 73, 73, 73,
|
||||||
];
|
];
|
||||||
|
|
||||||
static HDR_MAP: &[HeaderName] = &[
|
static HDR_MAP: &[RfcHeader] = &[
|
||||||
HeaderName::Date,
|
RfcHeader::Date,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Sender,
|
RfcHeader::Sender,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Received,
|
RfcHeader::Received,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::References,
|
RfcHeader::References,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Cc,
|
RfcHeader::Cc,
|
||||||
HeaderName::Comments,
|
RfcHeader::Comments,
|
||||||
HeaderName::ResentCc,
|
RfcHeader::ResentCc,
|
||||||
HeaderName::ContentId,
|
RfcHeader::ContentId,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ResentMessageId,
|
RfcHeader::ResentMessageId,
|
||||||
HeaderName::ReplyTo,
|
RfcHeader::ReplyTo,
|
||||||
HeaderName::ResentTo,
|
RfcHeader::ResentTo,
|
||||||
HeaderName::ResentBcc,
|
RfcHeader::ResentBcc,
|
||||||
HeaderName::ContentLanguage,
|
RfcHeader::ContentLanguage,
|
||||||
HeaderName::Subject,
|
RfcHeader::Subject,
|
||||||
HeaderName::ResentSender,
|
RfcHeader::ResentSender,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ResentDate,
|
RfcHeader::ResentDate,
|
||||||
HeaderName::To,
|
RfcHeader::To,
|
||||||
HeaderName::Bcc,
|
RfcHeader::Bcc,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ContentTransferEncoding,
|
RfcHeader::ContentTransferEncoding,
|
||||||
HeaderName::ReturnPath,
|
RfcHeader::ReturnPath,
|
||||||
HeaderName::ListId,
|
RfcHeader::ListId,
|
||||||
HeaderName::Keywords,
|
RfcHeader::Keywords,
|
||||||
HeaderName::ContentDescription,
|
RfcHeader::ContentDescription,
|
||||||
HeaderName::ListOwner,
|
RfcHeader::ListOwner,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ContentType,
|
RfcHeader::ContentType,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ListHelp,
|
RfcHeader::ListHelp,
|
||||||
HeaderName::MessageId,
|
RfcHeader::MessageId,
|
||||||
HeaderName::ContentLocation,
|
RfcHeader::ContentLocation,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ListSubscribe,
|
RfcHeader::ListSubscribe,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ListPost,
|
RfcHeader::ListPost,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ResentFrom,
|
RfcHeader::ResentFrom,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ContentDisposition,
|
RfcHeader::ContentDisposition,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::InReplyTo,
|
RfcHeader::InReplyTo,
|
||||||
HeaderName::ListArchive,
|
RfcHeader::ListArchive,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::From,
|
RfcHeader::From,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::ListUnsubscribe,
|
RfcHeader::ListUnsubscribe,
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::Other,
|
RfcHeader::MimeVersion, // Invalid
|
||||||
HeaderName::MimeVersion,
|
RfcHeader::MimeVersion,
|
||||||
];
|
];
|
||||||
|
|
||||||
static HDR_NAMES: &[&[u8]] = &[
|
static HDR_NAMES: &[&[u8]] = &[
|
||||||
|
|||||||
+283
-378
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level dir&ectory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
@@ -12,18 +12,14 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
decoders::{
|
decoders::{charsets::map::charset_decoder, DecodeFnc},
|
||||||
base64::decode_base64, charsets::map::get_charset_decoder,
|
ContentType, Encoding, GetHeader, HeaderValue, Message, MessagePart, MessagePartId, PartType,
|
||||||
quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult,
|
RfcHeader,
|
||||||
},
|
|
||||||
ContentType, HeaderName, HeaderValue, Message, MessageAttachment, MessagePart, MessagePartId,
|
|
||||||
MessageStructure, Part, RfcHeaders,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::MessageStream;
|
||||||
header::parse_headers,
|
|
||||||
mime::{get_bytes_to_boundary, seek_crlf_end, seek_next_part, skip_crlf, skip_multipart_end},
|
const MAX_NESTED_ENCODED: usize = 3;
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum MimeType {
|
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)]
|
#[inline(always)]
|
||||||
fn get_mime_type(
|
fn mime_type(
|
||||||
content_type: Option<&ContentType>,
|
content_type: Option<&ContentType>,
|
||||||
parent_content_type: &MimeType,
|
parent_content_type: &MimeType,
|
||||||
) -> (bool, bool, bool, MimeType) {
|
) -> (bool, bool, bool, MimeType) {
|
||||||
if let Some(content_type) = content_type {
|
if let Some(content_type) = content_type {
|
||||||
match content_type.get_type() {
|
match content_type.ctype() {
|
||||||
"multipart" => (
|
"multipart" => (
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
match content_type.get_subtype() {
|
match content_type.subtype() {
|
||||||
Some("mixed") => MimeType::MultipartMixed,
|
Some("mixed") => MimeType::MultipartMixed,
|
||||||
Some("alternative") => MimeType::MultipartAlernative,
|
Some("alternative") => MimeType::MultipartAlernative,
|
||||||
Some("related") => MimeType::MultipartRelated,
|
Some("related") => MimeType::MultipartRelated,
|
||||||
@@ -96,13 +60,13 @@ fn get_mime_type(
|
|||||||
_ => MimeType::Other,
|
_ => MimeType::Other,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"text" => match content_type.get_subtype() {
|
"text" => match content_type.subtype() {
|
||||||
Some("plain") => (false, true, true, MimeType::TextPlain),
|
Some("plain") => (false, true, true, MimeType::TextPlain),
|
||||||
Some("html") => (false, true, true, MimeType::TextHtml),
|
Some("html") => (false, true, true, MimeType::TextHtml),
|
||||||
_ => (false, false, true, MimeType::TextOther),
|
_ => (false, false, true, MimeType::TextOther),
|
||||||
},
|
},
|
||||||
"image" | "audio" | "video" => (false, true, false, MimeType::Inline),
|
"image" | "audio" | "video" => (false, true, false, MimeType::Inline),
|
||||||
"message" if content_type.get_subtype() == Some("rfc822") => {
|
"message" if [Some("rfc822"), Some("global")].contains(&content_type.subtype()) => {
|
||||||
(false, false, false, MimeType::Message)
|
(false, false, false, MimeType::Message)
|
||||||
}
|
}
|
||||||
_ => (false, false, false, MimeType::Other),
|
_ => (false, false, false, MimeType::Other),
|
||||||
@@ -114,25 +78,7 @@ fn get_mime_type(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[derive(Default, Debug)]
|
||||||
fn add_missing_type<'x>(
|
|
||||||
headers: &mut RfcHeaders<'x>,
|
|
||||||
c_type: Cow<'x, str>,
|
|
||||||
c_subtype: Cow<'x, str>,
|
|
||||||
) {
|
|
||||||
if headers.is_empty() {
|
|
||||||
headers.insert(
|
|
||||||
HeaderName::ContentType,
|
|
||||||
HeaderValue::ContentType(ContentType {
|
|
||||||
c_type,
|
|
||||||
c_subtype: Some(c_subtype),
|
|
||||||
attributes: None,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct MessageParserState {
|
struct MessageParserState {
|
||||||
mime_type: MimeType,
|
mime_type: MimeType,
|
||||||
mime_boundary: Option<Vec<u8>>,
|
mime_boundary: Option<Vec<u8>>,
|
||||||
@@ -142,8 +88,11 @@ struct MessageParserState {
|
|||||||
text_parts: usize,
|
text_parts: usize,
|
||||||
need_html_body: bool,
|
need_html_body: bool,
|
||||||
need_text_body: bool,
|
need_text_body: bool,
|
||||||
header_id: Option<MessagePartId>,
|
part_id: MessagePartId,
|
||||||
structure: Vec<MessageStructure>,
|
sub_part_ids: Vec<MessagePartId>,
|
||||||
|
offset_header: usize,
|
||||||
|
offset_body: usize,
|
||||||
|
offset_end: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MessageParserState {
|
impl MessageParserState {
|
||||||
@@ -160,29 +109,6 @@ impl MessageParserState {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_structure(&mut self) -> MessageStructure {
|
|
||||||
if let Some(header_id) = self.header_id {
|
|
||||||
MessageStructure::MultiPart((header_id, std::mem::take(&mut self.structure)))
|
|
||||||
} else if self.structure.len() > 1 {
|
|
||||||
MessageStructure::List(std::mem::take(&mut self.structure))
|
|
||||||
} else if self.structure.len() == 1 {
|
|
||||||
self.structure.pop().unwrap()
|
|
||||||
} else {
|
|
||||||
MessageStructure::List(vec![])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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> {
|
impl<'x> Message<'x> {
|
||||||
@@ -194,7 +120,7 @@ impl<'x> Message<'x> {
|
|||||||
|
|
||||||
/// Returns `false` if at least one header field was successfully parsed.
|
/// Returns `false` if at least one header field was successfully parsed.
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.headers_rfc.is_empty() && self.headers_other.is_empty()
|
self.parts.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a byte slice containing the RFC5322 raw message and returns a
|
/// Parses a byte slice containing the RFC5322 raw message and returns a
|
||||||
@@ -204,78 +130,68 @@ impl<'x> Message<'x> {
|
|||||||
/// if no headers are found None is returned.
|
/// if no headers are found None is returned.
|
||||||
///
|
///
|
||||||
pub fn parse(raw_message: &'x [u8]) -> Option<Message<'x>> {
|
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 stream = MessageStream::new(raw_message);
|
||||||
|
|
||||||
let mut message = Message::new();
|
let mut message = Message::new();
|
||||||
let mut message_stack = Vec::new();
|
|
||||||
|
|
||||||
let mut state = MessageParserState::new();
|
let mut state = MessageParserState::new();
|
||||||
let mut state_stack = Vec::new();
|
let mut state_stack = Vec::with_capacity(4);
|
||||||
|
|
||||||
let mut mime_part_header = RfcHeaders::new();
|
let mut part_headers = Vec::new();
|
||||||
|
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
// Parse headers
|
// Parse headers
|
||||||
let (is_message, header) = if let MimeType::Message = state.mime_type {
|
state.offset_header = stream.offset();
|
||||||
message.offset_header = stream.pos;
|
if !stream.parse_headers(&mut part_headers) {
|
||||||
if !parse_headers(
|
break;
|
||||||
&mut message.headers_rfc,
|
}
|
||||||
Some(&mut message.headers_other),
|
state.offset_body = stream.offset();
|
||||||
Some(&mut message.headers_offsets),
|
|
||||||
&mut stream,
|
|
||||||
) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
message.offset_body = seek_crlf_end(&stream, stream.pos);
|
|
||||||
(true, &mut message.headers_rfc)
|
|
||||||
} else {
|
|
||||||
if !parse_headers(&mut mime_part_header, None, None, &mut stream) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
(false, &mut mime_part_header)
|
|
||||||
};
|
|
||||||
|
|
||||||
state.parts += 1;
|
state.parts += 1;
|
||||||
|
state.sub_part_ids.push(message.parts.len());
|
||||||
|
|
||||||
let content_type = header
|
let content_type = part_headers
|
||||||
.get(&HeaderName::ContentType)
|
.rfc(&RfcHeader::ContentType)
|
||||||
.and_then(|c| c.as_content_type_ref());
|
.and_then(|c| c.as_content_type_ref());
|
||||||
|
|
||||||
let (is_multipart, mut is_inline, mut is_text, mut mime_type) =
|
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 is_multipart {
|
||||||
if let Some(mime_boundary) =
|
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 = ("\n--".to_string() + mime_boundary).into_bytes();
|
if stream.seek_next_part(mime_boundary.as_bytes()) {
|
||||||
|
let part_id = message.parts.len();
|
||||||
if seek_next_part(&mut stream, mime_boundary.as_ref()) {
|
|
||||||
let new_state = MessageParserState {
|
let new_state = MessageParserState {
|
||||||
in_alternative: state.in_alternative
|
in_alternative: state.in_alternative
|
||||||
|| mime_type == MimeType::MultipartAlernative,
|
|| mime_type == MimeType::MultipartAlernative,
|
||||||
mime_type,
|
mime_type,
|
||||||
mime_boundary: mime_boundary.into(),
|
mime_boundary: mime_boundary.as_bytes().to_vec().into(),
|
||||||
html_parts: message.html_body.len(),
|
html_parts: message.html_body.len(),
|
||||||
text_parts: message.text_body.len(),
|
text_parts: message.text_body.len(),
|
||||||
need_html_body: state.need_html_body,
|
need_html_body: state.need_html_body,
|
||||||
need_text_body: state.need_text_body,
|
need_text_body: state.need_text_body,
|
||||||
header_id: if !is_message {
|
part_id,
|
||||||
Some(message.parts.len())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
},
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
if !is_message {
|
//add_missing_type(&mut part_header, "text".into(), "plain".into());
|
||||||
add_missing_type(&mut mime_part_header, "text".into(), "plain".into());
|
message.parts.push(MessagePart {
|
||||||
message.parts.push(MessagePart::Multipart(std::mem::take(
|
headers: std::mem::take(&mut part_headers),
|
||||||
&mut mime_part_header,
|
offset_header: state.offset_header,
|
||||||
)));
|
offset_body: state.offset_body,
|
||||||
}
|
offset_end: 0,
|
||||||
state_stack.push(state);
|
is_encoding_problem: false,
|
||||||
|
encoding: Encoding::None,
|
||||||
|
body: PartType::default(),
|
||||||
|
});
|
||||||
|
state_stack.push((state, None));
|
||||||
state = new_state;
|
state = new_state;
|
||||||
skip_crlf(&mut stream);
|
stream.skip_crlf();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
mime_type = MimeType::TextOther;
|
mime_type = MimeType::TextOther;
|
||||||
@@ -284,106 +200,78 @@ impl<'x> Message<'x> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_crlf(&mut stream);
|
let (mut encoding, decode_fnc): (Encoding, DecodeFnc) = match part_headers
|
||||||
|
.rfc(&RfcHeader::ContentTransferEncoding)
|
||||||
let (is_binary, decode_fnc): (bool, DecodeFnc) = match header
|
|
||||||
.get(&HeaderName::ContentTransferEncoding)
|
|
||||||
{
|
{
|
||||||
Some(HeaderValue::Text(encoding)) if encoding.eq_ignore_ascii_case("base64") => {
|
Some(HeaderValue::Text(encoding)) if encoding.eq_ignore_ascii_case("base64") => {
|
||||||
(false, decode_base64)
|
(Encoding::Base64, MessageStream::decode_base64_mime)
|
||||||
}
|
}
|
||||||
Some(HeaderValue::Text(encoding))
|
Some(HeaderValue::Text(encoding))
|
||||||
if encoding.eq_ignore_ascii_case("quoted-printable") =>
|
if encoding.eq_ignore_ascii_case("quoted-printable") =>
|
||||||
{
|
{
|
||||||
(false, decode_quoted_printable)
|
(
|
||||||
|
Encoding::QuotedPrintable,
|
||||||
|
MessageStream::decode_quoted_printable_mime,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
_ => (true, get_bytes_to_boundary),
|
_ => (Encoding::None, MessageStream::mime_part),
|
||||||
};
|
};
|
||||||
|
|
||||||
state
|
if mime_type == MimeType::Message && encoding == Encoding::None {
|
||||||
.structure
|
|
||||||
.push(MessageStructure::Part(message.parts.len()));
|
|
||||||
|
|
||||||
if is_binary && mime_type == MimeType::Message {
|
|
||||||
let new_state = MessageParserState {
|
let new_state = MessageParserState {
|
||||||
mime_type: MimeType::Message,
|
mime_type: MimeType::Message,
|
||||||
mime_boundary: state.mime_boundary.take(),
|
mime_boundary: state.mime_boundary.take(),
|
||||||
need_html_body: true,
|
need_html_body: true,
|
||||||
need_text_body: true,
|
need_text_body: true,
|
||||||
|
part_id: message.parts.len(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
add_missing_type(&mut mime_part_header, "message".into(), "rfc822".into());
|
message.attachments.push(message.parts.len());
|
||||||
message_stack.push((message, std::mem::take(&mut mime_part_header)));
|
message.parts.push(MessagePart {
|
||||||
state_stack.push(state);
|
headers: std::mem::take(&mut part_headers),
|
||||||
|
encoding,
|
||||||
|
is_encoding_problem: false,
|
||||||
|
offset_header: state.offset_header,
|
||||||
|
offset_body: state.offset_body,
|
||||||
|
offset_end: 0,
|
||||||
|
body: PartType::default(), // Temp value, will be replaced later.
|
||||||
|
});
|
||||||
|
state_stack.push((state, message.into()));
|
||||||
message = Message::new();
|
message = Message::new();
|
||||||
state = new_state;
|
state = new_state;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (bytes_read, mut bytes) = decode_fnc(
|
let (offset_end, mut bytes) = decode_fnc(
|
||||||
&stream,
|
&mut stream,
|
||||||
stream.pos,
|
state.mime_boundary.as_deref().unwrap_or(&b""[..]),
|
||||||
state
|
|
||||||
.mime_boundary
|
|
||||||
.as_ref()
|
|
||||||
.map_or_else(|| &[][..], |b| &b[..]),
|
|
||||||
false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Attempt to recover contents of an invalid message
|
// Attempt to recover contents of an invalid message
|
||||||
if bytes_read == 0 {
|
let mut is_encoding_problem = offset_end == usize::MAX;
|
||||||
if stream.pos >= stream.data.len() || (is_binary && state.mime_boundary.is_none()) {
|
if is_encoding_problem {
|
||||||
state.structure.pop();
|
encoding = Encoding::None;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
};
|
|
||||||
|
|
||||||
if bytes_read == 0 {
|
|
||||||
// If there is 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;
|
|
||||||
} else {
|
|
||||||
state.structure.pop();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
state.structure.pop();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bytes = r_bytes;
|
|
||||||
stream.pos += bytes_read;
|
|
||||||
}
|
|
||||||
mime_type = MimeType::TextOther;
|
mime_type = MimeType::TextOther;
|
||||||
is_inline = false;
|
is_inline = false;
|
||||||
is_text = true;
|
is_text = true;
|
||||||
|
|
||||||
|
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 !boundary_found {
|
||||||
|
state.mime_boundary = None;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stream.pos += bytes_read;
|
state.offset_end = offset_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if mime_type != MimeType::Message {
|
let body_part = if mime_type != MimeType::Message {
|
||||||
let is_inline = is_inline
|
let is_inline = is_inline
|
||||||
&& header
|
&& part_headers
|
||||||
.get(&HeaderName::ContentDisposition)
|
.rfc(&RfcHeader::ContentDisposition)
|
||||||
.map_or_else(|| true, |d| !d.get_content_type().is_attachment())
|
.map_or_else(|| true, |d| !d.content_type().is_attachment())
|
||||||
&& (state.parts == 1
|
&& (state.parts == 1
|
||||||
|| (state.mime_type != MimeType::MultipartRelated
|
|| (state.mime_type != MimeType::MultipartRelated
|
||||||
&& (mime_type == MimeType::Inline
|
&& (mime_type == MimeType::Inline
|
||||||
@@ -415,12 +303,25 @@ impl<'x> Message<'x> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if is_text {
|
if is_text {
|
||||||
let is_html = mime_type == MimeType::TextHtml;
|
let text = match (
|
||||||
let text_part = Part {
|
bytes,
|
||||||
body: result_to_string(bytes, stream.data, content_type),
|
content_type.and_then(|ct| {
|
||||||
headers: std::mem::take(&mut mime_part_header),
|
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 {
|
if add_to_html && !is_html {
|
||||||
message.html_body.push(message.parts.len());
|
message.html_body.push(message.parts.len());
|
||||||
} else if add_to_text && is_html {
|
} else if add_to_text && is_html {
|
||||||
@@ -435,11 +336,11 @@ impl<'x> Message<'x> {
|
|||||||
message.attachments.push(message.parts.len());
|
message.attachments.push(message.parts.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
message.parts.push(if is_html {
|
if is_html {
|
||||||
MessagePart::Html(text_part)
|
PartType::Html(text)
|
||||||
} else {
|
} else {
|
||||||
MessagePart::Text(text_part)
|
PartType::Text(text)
|
||||||
});
|
}
|
||||||
} else {
|
} else {
|
||||||
if add_to_html {
|
if add_to_html {
|
||||||
message.html_body.push(message.parts.len());
|
message.html_body.push(message.parts.len());
|
||||||
@@ -450,45 +351,79 @@ impl<'x> Message<'x> {
|
|||||||
|
|
||||||
message.attachments.push(message.parts.len());
|
message.attachments.push(message.parts.len());
|
||||||
|
|
||||||
let binary_part = Part::new(
|
if !is_inline {
|
||||||
std::mem::take(&mut mime_part_header),
|
PartType::Binary(bytes)
|
||||||
result_to_bytes(bytes, stream.data),
|
|
||||||
);
|
|
||||||
|
|
||||||
message.parts.push(if !is_inline {
|
|
||||||
MessagePart::Binary(binary_part)
|
|
||||||
} else {
|
} else {
|
||||||
MessagePart::InlineBinary(binary_part)
|
PartType::InlineBinary(bytes)
|
||||||
});
|
}
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
add_missing_type(&mut mime_part_header, "message".into(), "rfc822".into());
|
|
||||||
message.attachments.push(message.parts.len());
|
message.attachments.push(message.parts.len());
|
||||||
message.parts.push(MessagePart::Message(Part::new(
|
|
||||||
std::mem::take(&mut mime_part_header),
|
if depth != 0 {
|
||||||
MessageAttachment::Raw(result_to_bytes(bytes, stream.data)),
|
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
|
||||||
|
message.parts.push(MessagePart {
|
||||||
|
headers: std::mem::take(&mut part_headers),
|
||||||
|
encoding,
|
||||||
|
is_encoding_problem,
|
||||||
|
body: body_part,
|
||||||
|
offset_header: state.offset_header,
|
||||||
|
offset_body: state.offset_body,
|
||||||
|
offset_end: state.offset_end,
|
||||||
|
});
|
||||||
|
|
||||||
if state.mime_boundary.is_some() {
|
if state.mime_boundary.is_some() {
|
||||||
// Currently processing a MIME part
|
// Currently processing a MIME part
|
||||||
let mut last_part_offset = stream.pos;
|
|
||||||
|
|
||||||
'inner: loop {
|
'inner: loop {
|
||||||
if let MimeType::Message = state.mime_type {
|
if let MimeType::Message = state.mime_type {
|
||||||
// Finished processing nested message, restore parent message from stack
|
// Finished processing a nested message, restore parent message from stack
|
||||||
if let (Some((mut prev_message, headers)), Some(mut prev_state)) =
|
if let Some((mut prev_state, Some(mut prev_message))) = state_stack.pop() {
|
||||||
(message_stack.pop(), state_stack.pop())
|
let offset_end = state
|
||||||
{
|
.mime_boundary
|
||||||
message.structure = state.get_structure();
|
.as_ref()
|
||||||
message.offset_end = seek_crlf_end(&stream, last_part_offset);
|
.map(|b| {
|
||||||
message.raw_message =
|
let pos = stream.offset().saturating_sub(b.len() + 2);
|
||||||
raw_message[message.offset_header..message.offset_end].into();
|
stream.data.get(pos - 2).map_or(pos - 1, |&ch| {
|
||||||
prev_message.attachments.push(prev_message.parts.len());
|
if ch == b'\r' {
|
||||||
prev_message.parts.push(MessagePart::Message(Part::new(
|
pos - 2
|
||||||
headers,
|
} else {
|
||||||
MessageAttachment::Parsed(Box::new(message)),
|
pos - 1
|
||||||
)));
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.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(message);
|
||||||
|
part.offset_end = offset_end;
|
||||||
|
} else {
|
||||||
|
debug_assert!(false, "Invalid part ID, could not find message.");
|
||||||
|
}
|
||||||
|
|
||||||
message = prev_message;
|
message = prev_message;
|
||||||
prev_state.mime_boundary = state.mime_boundary;
|
prev_state.mime_boundary = state.mime_boundary;
|
||||||
state = prev_state;
|
state = prev_state;
|
||||||
@@ -498,7 +433,7 @@ impl<'x> Message<'x> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if skip_multipart_end(&mut stream) {
|
if stream.is_multipart_end() {
|
||||||
// End of MIME part reached
|
// End of MIME part reached
|
||||||
|
|
||||||
if MimeType::MultipartAlernative == state.mime_type
|
if MimeType::MultipartAlernative == state.mime_type
|
||||||
@@ -524,71 +459,94 @@ impl<'x> Message<'x> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(mut prev_state) = state_stack.pop() {
|
if let Some(part) = message.parts.get_mut(state.part_id) {
|
||||||
// Add headers and substructure to parent part
|
// Add headers and substructure to parent part
|
||||||
prev_state.structure.push(state.get_structure());
|
part.body =
|
||||||
|
PartType::Multipart(std::mem::take(&mut state.sub_part_ids));
|
||||||
|
|
||||||
// Restore ancestor's state
|
// Restore ancestor's state
|
||||||
state = prev_state;
|
if let Some((prev_state, _)) = state_stack.pop() {
|
||||||
last_part_offset = stream.pos;
|
state = prev_state;
|
||||||
|
|
||||||
if let Some(ref mime_boundary) = state.mime_boundary {
|
if let Some(ref mime_boundary) = state.mime_boundary {
|
||||||
// Ancestor has a MIME boundary, seek it.
|
// Ancestor has a MIME boundary, seek it.
|
||||||
if seek_next_part(&mut stream, mime_boundary) {
|
if let Some(offset) =
|
||||||
continue 'inner;
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
break 'outer;
|
break 'outer;
|
||||||
} else {
|
} else {
|
||||||
skip_crlf(&mut stream);
|
|
||||||
// Headers of next part expected next, break inner look.
|
// Headers of next part expected next, break inner look.
|
||||||
break 'inner;
|
break 'inner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if stream.pos >= stream.data.len() {
|
} else if stream.offset() >= stream.data.len() {
|
||||||
break 'outer;
|
break 'outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while let (Some((mut prev_message, headers)), Some(prev_state)) =
|
// Corrupted MIME message, try to recover whatever is possible.
|
||||||
(message_stack.pop(), state_stack.pop())
|
while let Some((prev_state, prev_message)) = state_stack.pop() {
|
||||||
{
|
if let Some(mut prev_message) = prev_message {
|
||||||
message.offset_end = stream.pos;
|
message.raw_message = raw_message.into(); //raw_message[state.offset_header..stream.offset()].as_ref().into();
|
||||||
if !message.is_empty() {
|
|
||||||
message.structure = state.get_structure();
|
if let Some(part) = prev_message.parts.get_mut(state.part_id) {
|
||||||
message.raw_message = raw_message[message.offset_header..message.offset_end].into();
|
part.body = PartType::Message(message);
|
||||||
prev_message.attachments.push(prev_message.parts.len());
|
part.offset_end = stream.offset();
|
||||||
prev_message.parts.push(MessagePart::Message(Part::new(
|
} else {
|
||||||
headers,
|
debug_assert!(false, "Invalid part ID, could not find message.");
|
||||||
MessageAttachment::Parsed(Box::new(message)),
|
}
|
||||||
)));
|
|
||||||
|
message = prev_message;
|
||||||
|
} else if let Some(part) = message.parts.get_mut(state.part_id) {
|
||||||
|
part.offset_end = stream.offset();
|
||||||
|
part.body = PartType::Multipart(state.sub_part_ids);
|
||||||
|
} else {
|
||||||
|
debug_assert!(false, "This should not have happened.");
|
||||||
}
|
}
|
||||||
message = prev_message;
|
|
||||||
state = prev_state;
|
state = prev_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.raw_message = raw_message.into();
|
message.raw_message = raw_message.into();
|
||||||
message.structure = state.get_structure();
|
|
||||||
message.offset_end = stream.pos;
|
|
||||||
|
|
||||||
if !message.is_empty() {
|
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)
|
Some(message)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
|
|
||||||
use serde_json::Value;
|
|
||||||
|
|
||||||
use crate::parsers::message::Message;
|
use crate::parsers::message::Message;
|
||||||
|
|
||||||
const SEPARATOR: &[u8] = "\n---- EXPECTED STRUCTURE ----\n".as_bytes();
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_full_messages() {
|
fn parse_full_messages() {
|
||||||
for test_suite in ["rfc", "legacy", "thirdparty", "malformed"] {
|
for test_suite in ["rfc", "legacy", "thirdparty", "malformed"] {
|
||||||
@@ -599,40 +557,44 @@ mod tests {
|
|||||||
let mut tests_run = 0;
|
let mut tests_run = 0;
|
||||||
|
|
||||||
for file_name in fs::read_dir(&test_dir).unwrap() {
|
for file_name in fs::read_dir(&test_dir).unwrap() {
|
||||||
let file_name = file_name.as_ref().unwrap().path();
|
let mut file_name = file_name.unwrap().path();
|
||||||
if file_name.extension().map_or(false, |e| e == "txt") {
|
if file_name.extension().map_or(false, |e| e == "eml") {
|
||||||
let mut input = fs::read(&file_name).unwrap();
|
let raw_original = fs::read(&file_name).unwrap();
|
||||||
let mut pos = 0;
|
|
||||||
|
|
||||||
for sep_pos in 0..input.len() {
|
|
||||||
if input[sep_pos..sep_pos + SEPARATOR.len()].eq(SEPARATOR) {
|
|
||||||
pos = sep_pos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert!(
|
|
||||||
pos > 0,
|
|
||||||
"Failed to find separator in test file '{}'.",
|
|
||||||
file_name.display()
|
|
||||||
);
|
|
||||||
|
|
||||||
tests_run += 1;
|
tests_run += 1;
|
||||||
|
|
||||||
let input = input.split_at_mut(pos);
|
// Test without CRs
|
||||||
let message = Message::parse(input.0).unwrap();
|
let raw_message = strip_crlf(&raw_original);
|
||||||
|
file_name.set_extension("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();
|
let json_message = serde_json::to_string_pretty(&message).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
if json_message.as_bytes() != expected_result {
|
||||||
serde_json::from_str::<Value>(&json_message).unwrap(),
|
file_name.set_extension("failed");
|
||||||
serde_json::from_str::<Value>(
|
fs::write(&file_name, json_message.as_bytes()).unwrap();
|
||||||
std::str::from_utf8(&input.1[SEPARATOR.len()..]).unwrap()
|
panic!(
|
||||||
)
|
"Test failed, parsed message saved to {}",
|
||||||
.unwrap(),
|
file_name.display()
|
||||||
"Test failed for '{}', result was:\n{}",
|
);
|
||||||
file_name.display(),
|
}
|
||||||
json_message
|
|
||||||
);
|
// 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()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,85 +606,28 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#[test]
|
fn add_crlf(bytes: &[u8]) -> Vec<u8> {
|
||||||
fn message_to_yaml() {
|
let mut result = Vec::with_capacity(bytes.len());
|
||||||
let mut file_name = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
let mut last_ch = 0;
|
||||||
file_name.push("tests");
|
for &ch in bytes {
|
||||||
file_name.push("rfc");
|
if ch == b'\n' && last_ch != b'\r' {
|
||||||
file_name.push("003.txt");
|
result.push(b'\r');
|
||||||
|
|
||||||
let mut input = fs::read(&file_name).unwrap();
|
|
||||||
let mut pos = 0;
|
|
||||||
|
|
||||||
for sep_pos in 0..input.len() {
|
|
||||||
if input[sep_pos..sep_pos + SEPARATOR.len()].eq(SEPARATOR) {
|
|
||||||
pos = sep_pos;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
result.push(ch);
|
||||||
|
last_ch = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(
|
result
|
||||||
pos > 0,
|
|
||||||
"Failed to find separator in test file '{}'.",
|
|
||||||
file_name.display()
|
|
||||||
);
|
|
||||||
|
|
||||||
let input = input.split_at_mut(pos).0;
|
|
||||||
let message = Message::parse(input).unwrap();
|
|
||||||
let result = serde_yaml::to_string(&message).unwrap();
|
|
||||||
|
|
||||||
fs::write("test.yaml", &result).unwrap();
|
|
||||||
|
|
||||||
println!("{:}", result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
fn strip_crlf(bytes: &[u8]) -> Vec<u8> {
|
||||||
fn generate_test_samples() {
|
let mut result = Vec::with_capacity(bytes.len());
|
||||||
const SEPARATOR: &[u8] = "\n---- EXPECTED STRUCTURE ----\n".as_bytes();
|
for &ch in bytes {
|
||||||
|
if !ch != b'\r' {
|
||||||
for test_suite in ["legacy", "malformed", "rfc", "thirdparty"] {
|
result.push(ch);
|
||||||
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
||||||
test_dir.push("tests");
|
|
||||||
test_dir.push(test_suite);
|
|
||||||
|
|
||||||
for file_name in fs::read_dir(test_dir).unwrap() {
|
|
||||||
if file_name
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.path()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.contains("COPYING")
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut input = fs::read(file_name.as_ref().unwrap().path()).unwrap();
|
|
||||||
let mut pos = 0;
|
|
||||||
for sep_pos in 0..input.len() {
|
|
||||||
if input[sep_pos..sep_pos + SEPARATOR.len()].eq(SEPARATOR) {
|
|
||||||
pos = sep_pos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert!(pos > 0, "Failed to find separator.");
|
|
||||||
let input = input.split_at_mut(pos);
|
|
||||||
|
|
||||||
/*println!(
|
|
||||||
"{}",
|
|
||||||
serde_json::to_string_pretty(&Message::parse(input.0)).unwrap()
|
|
||||||
);*/
|
|
||||||
|
|
||||||
let mut output = Vec::new();
|
|
||||||
output.extend_from_slice(input.0);
|
|
||||||
output.extend_from_slice(SEPARATOR);
|
|
||||||
output.extend_from_slice(
|
|
||||||
serde_json::to_string_pretty(&Message::parse(input.0).unwrap())
|
|
||||||
.unwrap()
|
|
||||||
.as_bytes(),
|
|
||||||
);
|
|
||||||
fs::write(file_name.as_ref().unwrap().path(), &output).unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+134
-110
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,140 +9,164 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::decoders::DecodeResult;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use super::message::MessageStream;
|
use super::MessageStream;
|
||||||
|
|
||||||
pub fn seek_next_part(stream: &mut MessageStream, boundary: &[u8]) -> bool {
|
impl<'x> MessageStream<'x> {
|
||||||
if !boundary.is_empty() {
|
pub fn seek_next_part(&mut self, boundary: &[u8]) -> bool {
|
||||||
let mut pos = stream.pos;
|
if !boundary.is_empty() {
|
||||||
|
let mut last_ch = 0;
|
||||||
|
|
||||||
let mut match_count = 0;
|
self.checkpoint();
|
||||||
|
|
||||||
for ch in &stream.data[pos..] {
|
while let Some(&ch) = self.next() {
|
||||||
pos += 1;
|
if ch == b'-' && last_ch == b'-' && self.try_skip(boundary) {
|
||||||
|
|
||||||
if ch == &boundary[match_count] {
|
|
||||||
match_count += 1;
|
|
||||||
if match_count == boundary.len() {
|
|
||||||
stream.pos = pos;
|
|
||||||
return true;
|
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 fn get_bytes_to_boundary<'x>(
|
while let Some(&ch) = self.next() {
|
||||||
stream: &MessageStream<'x>,
|
if ch == b'\n' {
|
||||||
start_pos: usize,
|
offset_pos = if last_ch == b'\r' {
|
||||||
boundary: &[u8],
|
self.offset() - 2
|
||||||
_is_word: bool,
|
|
||||||
) -> (usize, DecodeResult) {
|
|
||||||
let mut read_pos = start_pos;
|
|
||||||
|
|
||||||
if !boundary.is_empty() {
|
|
||||||
let mut match_count = 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 match_pos = read_pos - match_count;
|
|
||||||
|
|
||||||
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;
|
|
||||||
} else {
|
} else {
|
||||||
match_count = 0;
|
self.offset() - 1
|
||||||
}
|
};
|
||||||
|
} else if ch == b'-' && last_ch == b'-' && self.try_skip(boundary) {
|
||||||
|
return offset_pos.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
if boundary.is_empty() {
|
||||||
DecodeResult::Borrowed((start_pos, stream.data.len())),
|
self.offset()
|
||||||
|
} else {
|
||||||
|
self.restore();
|
||||||
|
usize::MAX
|
||||||
|
},
|
||||||
|
self.bytes(start_pos..self.len()).into(),
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
(0, DecodeResult::Empty)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(always)]
|
pub fn seek_part_end(&mut self, boundary: Option<&[u8]>) -> (usize, bool) {
|
||||||
pub fn is_boundary_end(stream: &MessageStream, pos: usize) -> bool {
|
let mut last_ch = b'\n';
|
||||||
matches!(
|
let mut before_last_ch = 0;
|
||||||
stream.data.get(pos..),
|
let mut end_pos = self.offset();
|
||||||
Some([b'\n' | b'\r' | b' ' | b'\t', ..]) | Some([b'-', b'-', ..]) | Some([]) | None
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn skip_multipart_end(stream: &mut MessageStream) -> bool {
|
if let Some(boundary) = boundary {
|
||||||
match stream.data.get(stream.pos..stream.pos + 2) {
|
while let Some(&ch) = self.next() {
|
||||||
Some(b"--") => {
|
if ch == b'\n' {
|
||||||
if let Some(byte) = stream.data.get(stream.pos + 2) {
|
end_pos = if last_ch == b'\r' {
|
||||||
if !(*byte).is_ascii_whitespace() {
|
self.offset() - 2
|
||||||
return false;
|
} 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)]
|
before_last_ch = last_ch;
|
||||||
pub fn skip_crlf(stream: &mut MessageStream) {
|
last_ch = ch;
|
||||||
for ch in &stream.data[stream.pos..] {
|
|
||||||
match ch {
|
|
||||||
b'\r' | b' ' | b'\t' => stream.pos += 1,
|
|
||||||
b'\n' => {
|
|
||||||
stream.pos += 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
_ => break,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(always)]
|
(self.offset(), false)
|
||||||
pub fn seek_crlf_end(stream: &MessageStream, mut start_pos: usize) -> usize {
|
|
||||||
for ch in &stream.data[start_pos..] {
|
|
||||||
if ch.is_ascii_whitespace() {
|
|
||||||
start_pos += 1;
|
|
||||||
} else {
|
} else {
|
||||||
break;
|
self.seek_end();
|
||||||
|
(self.offset(), true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
start_pos
|
|
||||||
}
|
}
|
||||||
|
|||||||
+143
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -9,7 +9,149 @@
|
|||||||
* except according to those terms.
|
* except according to those terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::{iter::Peekable, ops::Range, slice::Iter};
|
||||||
|
|
||||||
pub mod fields;
|
pub mod fields;
|
||||||
pub mod header;
|
pub mod header;
|
||||||
pub mod message;
|
pub mod message;
|
||||||
pub mod mime;
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
|
* file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||||
|
* option. This file may not be copied, modified, or distributed
|
||||||
|
* except according to those terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use crate::decoders::html::html_to_text;
|
||||||
|
|
||||||
|
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>(text: Cow<'_, str>, mut max_len: usize) -> Cow<'x, str> {
|
||||||
|
if text.len() > max_len {
|
||||||
|
let add_dots = max_len > 6;
|
||||||
|
if add_dots {
|
||||||
|
max_len -= 3;
|
||||||
|
}
|
||||||
|
let mut result = String::with_capacity(max_len);
|
||||||
|
for ch in text.chars() {
|
||||||
|
if ch.len_utf8() + result.len() > max_len {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result.push(ch);
|
||||||
|
}
|
||||||
|
if add_dots {
|
||||||
|
result.push_str("...");
|
||||||
|
}
|
||||||
|
result.into()
|
||||||
|
} else {
|
||||||
|
text.into_owned().into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn truncate_text<'x>(text: Cow<'_, str>, max_len: usize) -> Cow<'x, str> {
|
||||||
|
preview_text(text, max_len)
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
max_len -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut result = String::with_capacity(max_len);
|
||||||
|
let mut in_tag = false;
|
||||||
|
let mut in_comment = false;
|
||||||
|
let mut last_tag_end_pos = 0;
|
||||||
|
for (pos, ch) in html.char_indices() {
|
||||||
|
let mut set_last_tag = 0;
|
||||||
|
match ch {
|
||||||
|
'<' if !in_tag => {
|
||||||
|
in_tag = true;
|
||||||
|
if let Some("!--") = html.get(pos + 1..pos + 4) {
|
||||||
|
in_comment = true;
|
||||||
|
}
|
||||||
|
set_last_tag = pos;
|
||||||
|
}
|
||||||
|
'>' if in_tag => {
|
||||||
|
if in_comment {
|
||||||
|
if let Some("--") = html.get(pos - 2..pos) {
|
||||||
|
in_comment = false;
|
||||||
|
in_tag = false;
|
||||||
|
set_last_tag = pos + 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
in_tag = false;
|
||||||
|
set_last_tag = pos + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
if ch.len_utf8() + pos > max_len {
|
||||||
|
result.push_str(
|
||||||
|
&html[0..if (in_tag || set_last_tag > 0) && last_tag_end_pos > 0 {
|
||||||
|
last_tag_end_pos
|
||||||
|
} else {
|
||||||
|
pos
|
||||||
|
}],
|
||||||
|
);
|
||||||
|
if add_dots {
|
||||||
|
result.push_str("...");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else if set_last_tag > 0 {
|
||||||
|
last_tag_end_pos = set_last_tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.into()
|
||||||
|
} else {
|
||||||
|
html.into_owned().into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn text_preview() {
|
||||||
|
let text_1 = 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)"
|
||||||
|
);
|
||||||
|
let text_2 = concat!(
|
||||||
|
"長沮、桀溺耦而耕,孔子過之,使子路問津焉。長沮曰:「夫執輿者為誰?」",
|
||||||
|
"子路曰:「為孔丘。」曰:「是魯孔丘與?」曰:「是也。」曰:「是知津矣。」問於桀溺,",
|
||||||
|
"桀溺曰:「子為誰?」曰:「為仲由。」曰:「是魯孔丘之徒與?」對曰:「然。",
|
||||||
|
"」曰:「滔滔者天下皆是也,而誰以易之?且而與其從辟人之士也,豈若從",
|
||||||
|
"辟世之士哉?」耰而不輟。子路行以告。夫子憮然曰:「鳥獸不可與同群,吾非斯人之徒",
|
||||||
|
"與而誰與?天下有道,丘不與易也。」",
|
||||||
|
"子路從而後,遇丈人,以杖荷蓧。子路問曰:「子見夫子乎?」丈人曰:「四體不勤,",
|
||||||
|
"五穀不分。孰為夫子?」植其杖而芸。子路拱而立。止子路宿,殺雞為黍而食之,見其二",
|
||||||
|
"子焉。明日,子路行以告。子曰:「隱者也。」使子路反見之。至則行矣。子路曰:「",
|
||||||
|
"不仕無義。長幼之節,不可廢也;君臣之義,如之何其廢之?欲潔其身,而亂大倫。君",
|
||||||
|
"子之仕也,行其義也。道之不行,已知之矣。」"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
super::truncate_text(text_1.into(), 110),
|
||||||
|
"J'interdis aux marchands de vanter trop leurs marchandises. Car ils se fontvite pédagogues et t'enseignent..."
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
super::truncate_text(text_2.into(), 110),
|
||||||
|
"長沮、桀溺耦而耕,孔子過之,使子路問津焉。長沮曰:「夫執輿者為誰?」子..."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn html_truncate() {
|
||||||
|
for (html, expected_result) in [
|
||||||
|
(
|
||||||
|
"<html>hello<br/>world<br/></html>",
|
||||||
|
"<html>hello<br/>world...",
|
||||||
|
),
|
||||||
|
("<html>using <><br/></html>", "<html>using <><br/>..."),
|
||||||
|
(
|
||||||
|
"test <not br/>tag<br />test <not br/>tag<br />",
|
||||||
|
"test <not br/>tag...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"<>< ><tag\n/>>hello world< br \n />",
|
||||||
|
"<>< ><tag\n/>>hello ...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
concat!(
|
||||||
|
"<head><title>ignore head</title><not head>xyz</not head></head>",
|
||||||
|
"<h1><body></h1>"
|
||||||
|
),
|
||||||
|
"<head><title>ignore he...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
concat!(
|
||||||
|
"<p>what is ♥?</p><p>ßĂΒγ ",
|
||||||
|
"don't hurt me.</p>"
|
||||||
|
),
|
||||||
|
"<p>what is ♥...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"<!-- <> < < < -->the actual<!--> text",
|
||||||
|
"<!-- <> < < < -->the a...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
" < p > hello < / p > < p > world < / p > !!! < br > ",
|
||||||
|
" < p > hello ...",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
" <p>please unsubscribe <a href=#>here</a>.</p> ",
|
||||||
|
" <p>please unsubscribe...",
|
||||||
|
),
|
||||||
|
] {
|
||||||
|
assert_eq!(super::truncate_html(html.into(), 25), expected_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+46
-39
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright Stalwart Labs, Minter Ltd. See the COPYING
|
* Copyright Stalwart Labs Ltd. See the COPYING
|
||||||
* file at the top-level directory of this distribution.
|
* file at the top-level directory of this distribution.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
@@ -57,81 +57,88 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||||||
let message = Message::parse(input).unwrap();
|
let message = Message::parse(input).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_from(),
|
bincode::deserialize::<Vec<Header>>(
|
||||||
&HeaderValue::Address(Addr {
|
&bincode::serialize(&message.parts[0].headers).unwrap()
|
||||||
name: Some("Art Vandelay (Vandelay Industries)".into()),
|
)
|
||||||
address: Some("art@vandelay.com".into())
|
.unwrap(),
|
||||||
})
|
message.parts[0].headers
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_to(),
|
message.from(),
|
||||||
|
&HeaderValue::Address(Addr::new(
|
||||||
|
"Art Vandelay (Vandelay Industries)".into(),
|
||||||
|
"art@vandelay.com"
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
message.to(),
|
||||||
&HeaderValue::GroupList(vec![
|
&HeaderValue::GroupList(vec![
|
||||||
Group {
|
Group::new(
|
||||||
name: Some("Colleagues".into()),
|
"Colleagues",
|
||||||
addresses: vec![Addr {
|
vec![Addr::new("James Smythe".into(), "james@vandelay.com")]
|
||||||
name: Some("James Smythe".into()),
|
),
|
||||||
address: Some("james@vandelay.com".into())
|
Group::new(
|
||||||
}]
|
"Friends",
|
||||||
},
|
vec![
|
||||||
Group {
|
Addr::new(None, "jane@example.com"),
|
||||||
name: Some("Friends".into()),
|
Addr::new("John Smîth".into(), "john@example.com"),
|
||||||
addresses: vec![
|
|
||||||
Addr {
|
|
||||||
name: None,
|
|
||||||
address: Some("jane@example.com".into())
|
|
||||||
},
|
|
||||||
Addr {
|
|
||||||
name: Some("John Smîth".into()),
|
|
||||||
address: Some("john@example.com".into())
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_date().unwrap().to_iso8601(),
|
message.date().unwrap().to_rfc3339(),
|
||||||
"2021-11-20T14:22:01-08:00"
|
"2021-11-20T14:22:01-08:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_subject().unwrap(),
|
message.subject().unwrap(),
|
||||||
"Why not both importing AND exporting? ☺"
|
"Why not both importing AND exporting? ☺"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_html_body(0).unwrap(),
|
message.body_html(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"<html><p>I was thinking about quitting the “exporting” to ",
|
"<html><p>I was thinking about quitting the “exporting” to ",
|
||||||
"focus just on the “importing”,</p><p>but then I thought,",
|
"focus just on the “importing”,</p><p>but then I thought,",
|
||||||
" why not do both? ☺</p></html>"
|
" why not do both? ☺</p></html>"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
message.get_text_body(0).unwrap(),
|
message.body_text(0).unwrap(),
|
||||||
concat!(
|
concat!(
|
||||||
"I was thinking about quitting the “exporting” to focus just on the",
|
"I was thinking about quitting the “exporting” to focus just on the",
|
||||||
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
" “importing”,\nbut then I thought, why not do both? ☺\n"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
let nested_message = message.get_attachment(0).unwrap().unwrap_message();
|
|
||||||
|
let nested_message = message.attachment(0).unwrap().message().unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_subject().unwrap(),
|
nested_message.subject().unwrap(),
|
||||||
"Exporting my book about coffee tables"
|
"Exporting my book about coffee tables"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_text_body(0).unwrap(),
|
nested_message.body_text(0).unwrap(),
|
||||||
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
"ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_message.get_html_body(0).unwrap(),
|
nested_message.body_html(0).unwrap(),
|
||||||
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
"<html><body>ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!</body></html>"
|
||||||
);
|
);
|
||||||
let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary();
|
|
||||||
|
let nested_attachment = nested_message.attachment(0).unwrap();
|
||||||
|
|
||||||
assert_eq!(nested_attachment.len(), 42);
|
assert_eq!(nested_attachment.len(), 42);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
nested_attachment.get_attachment_name().unwrap(),
|
nested_attachment.attachment_name().unwrap(),
|
||||||
"Book about ☕ tables.gif"
|
"Book about ☕ tables.gif"
|
||||||
);
|
);
|
||||||
|
|
||||||
//println!("{}", serde_json::to_string_pretty(&message).unwrap());
|
|
||||||
//println!("{}", serde_yaml::to_string(&message).unwrap());
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: "Joe Blow" <jblow@example.com>
|
||||||
|
Subject: Test message from Microsoft Outlook 00
|
||||||
|
Date: Wed, 17 May 2000 19:35:05 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="redball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="redball.png"
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
|
||||||
|
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
|
||||||
|
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
|
||||||
|
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
|
||||||
|
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
|
||||||
|
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
|
||||||
|
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
|
||||||
|
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
|
||||||
|
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
|
||||||
|
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
|
||||||
|
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
|
||||||
|
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
|
||||||
|
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
|
||||||
|
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
|
||||||
|
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
|
||||||
|
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
|
||||||
|
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
|
||||||
|
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
|
||||||
|
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
|
||||||
|
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
|
||||||
|
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
|
||||||
|
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
|
||||||
|
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: "Joe Blow" <jblow@example.com>,
|
||||||
|
=?utf-7?B?SitBUHctcmdlbiBTY2htK0FQdy1yZ2Vu?= <schmuergen@example.com>
|
||||||
|
Subject: =?utf-7?Q?Die_Hasen_und_die_Fr+APY-sche_=28Microsoft_Outlook_00=29?=
|
||||||
|
Date: Wed, 17 May 2000 19:18:39 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="utf-7"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
Die Hasen und die Fr+APY-sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst +APw-ber ihre mi+AN8-liche Lage+ADs- +ACI-wir =
|
||||||
|
leben+ACI-, sprach ein Redner, +ACI-in steter Furcht vor Menschen und =
|
||||||
|
Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere+ACE- =
|
||||||
|
Unsere stete Angst ist +AOQ-rger als der Tod selbst. Auf, la+AN8-t uns =
|
||||||
|
ein f+APw-r allemal sterben.+ACI-=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers+AOQ-ufen+ADs- sie eilten =
|
||||||
|
ihm zu+ADs- allein das au+AN8-erordentliche Get+APY-se und ihre =
|
||||||
|
wunderbare Gestalt erschreckte eine Menge Fr+APY-sche, die am Ufer =
|
||||||
|
sa+AN8-en, so sehr, da+AN8- sie aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
+ACI-Halt+ACI-, rief nun eben dieser Sprecher, +ACI-wir wollen das =
|
||||||
|
Ers+AOQ-ufen noch ein wenig aufschieben, denn auch uns f+APw-rchten, wie =
|
||||||
|
ihr seht, einige Tiere, welche also wohl noch ungl+APw-cklicher sein =
|
||||||
|
m+APw-ssen als wir.+ACI-=20
|
||||||
|
|
||||||
@@ -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": 39
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "to"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"AddressList": [
|
||||||
|
{
|
||||||
|
"name": "Joe Blow",
|
||||||
|
"address": "jblow@example.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jürgen Schmürgen",
|
||||||
|
"address": "schmuergen@example.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"offset_field": 39,
|
||||||
|
"offset_start": 42,
|
||||||
|
"offset_end": 146
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "subject"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
||||||
|
},
|
||||||
|
"offset_field": 146,
|
||||||
|
"offset_start": 154,
|
||||||
|
"offset_end": 224
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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": 224,
|
||||||
|
"offset_start": 229,
|
||||||
|
"offset_end": 262
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "message_id"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com"
|
||||||
|
},
|
||||||
|
"offset_field": 262,
|
||||||
|
"offset_start": 273,
|
||||||
|
"offset_end": 322
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "mime_version"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "1.0"
|
||||||
|
},
|
||||||
|
"offset_field": 322,
|
||||||
|
"offset_start": 335,
|
||||||
|
"offset_end": 340
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"ContentType": {
|
||||||
|
"c_type": "text",
|
||||||
|
"c_subtype": "plain",
|
||||||
|
"attributes": [
|
||||||
|
[
|
||||||
|
"charset",
|
||||||
|
"utf-7"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"offset_field": 340,
|
||||||
|
"offset_start": 353,
|
||||||
|
"offset_end": 383
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "quoted-printable"
|
||||||
|
},
|
||||||
|
"offset_field": 383,
|
||||||
|
"offset_start": 409,
|
||||||
|
"offset_end": 427
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "3 (Normal)"
|
||||||
|
},
|
||||||
|
"offset_field": 427,
|
||||||
|
"offset_start": 438,
|
||||||
|
"offset_end": 450
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MSMail-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 450,
|
||||||
|
"offset_start": 468,
|
||||||
|
"offset_end": 476
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Mailer"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
||||||
|
},
|
||||||
|
"offset_field": 476,
|
||||||
|
"offset_start": 485,
|
||||||
|
"offset_end": 537
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "Importance"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 537,
|
||||||
|
"offset_start": 548,
|
||||||
|
"offset_end": 556
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MimeOLE"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
||||||
|
},
|
||||||
|
"offset_field": 556,
|
||||||
|
"offset_start": 566,
|
||||||
|
"offset_end": 613
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Text": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
|
||||||
|
},
|
||||||
|
"offset_header": 0,
|
||||||
|
"offset_body": 614,
|
||||||
|
"offset_end": 1491
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: "Joe Blow" <jblow@example.com>,
|
|
||||||
=?utf-7?B?SitBUHctcmdlbiBTY2htK0FQdy1yZ2Vu?= <schmuergen@example.com>
|
|
||||||
Subject: =?utf-7?Q?Die_Hasen_und_die_Fr+APY-sche_=28Microsoft_Outlook_00=29?=
|
|
||||||
Date: Wed, 17 May 2000 19:18:39 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="utf-7"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
Die Hasen und die Fr+APY-sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst +APw-ber ihre mi+AN8-liche Lage+ADs- +ACI-wir =
|
|
||||||
leben+ACI-, sprach ein Redner, +ACI-in steter Furcht vor Menschen und =
|
|
||||||
Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere+ACE- =
|
|
||||||
Unsere stete Angst ist +AOQ-rger als der Tod selbst. Auf, la+AN8-t uns =
|
|
||||||
ein f+APw-r allemal sterben.+ACI-=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers+AOQ-ufen+ADs- sie eilten =
|
|
||||||
ihm zu+ADs- allein das au+AN8-erordentliche Get+APY-se und ihre =
|
|
||||||
wunderbare Gestalt erschreckte eine Menge Fr+APY-sche, die am Ufer =
|
|
||||||
sa+AN8-en, so sehr, da+AN8- sie aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
+ACI-Halt+ACI-, rief nun eben dieser Sprecher, +ACI-wir wollen das =
|
|
||||||
Ers+AOQ-ufen noch ein wenig aufschieben, denn auch uns f+APw-rchten, wie =
|
|
||||||
ihr seht, einige Tiere, welche also wohl noch ungl+APw-cklicher sein =
|
|
||||||
m+APw-ssen als wir.+ACI-=20
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"AddressList": [
|
|
||||||
{
|
|
||||||
"name": "Joe Blow",
|
|
||||||
"address": "jblow@example.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jürgen Schmürgen",
|
|
||||||
"address": "schmuergen@example.com"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "utf-7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 18,
|
|
||||||
"second": 39,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 39
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 42,
|
|
||||||
"end": 146
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 154,
|
|
||||||
"end": 224
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 229,
|
|
||||||
"end": 262
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 273,
|
|
||||||
"end": 322
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 335,
|
|
||||||
"end": 340
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 353,
|
|
||||||
"end": 383
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 409,
|
|
||||||
"end": 427
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 438,
|
|
||||||
"end": 450
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 468,
|
|
||||||
"end": 476
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 485,
|
|
||||||
"end": 537
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 548,
|
|
||||||
"end": 556
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 566,
|
|
||||||
"end": 613
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 614,
|
|
||||||
"offset_end": 1491
|
|
||||||
}
|
|
||||||
@@ -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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n\n"
|
||||||
|
},
|
||||||
|
"offset_header": 0,
|
||||||
|
"offset_body": 500,
|
||||||
|
"offset_end": 1499
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519003052.00a89c40@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
X-Priority: 2 (High)
|
||||||
|
Date: Fri, 19 May 2000 00:31:00 -0400
|
||||||
|
To: Heinz =?iso-8859-1?Q?M=FCller?= <mueller@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/html; charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<font face=3D"Arial, Helvetica" size=3D5 color=3D"#0000FF"><b>Die Hasen und =
|
||||||
|
die
|
||||||
|
Fr=F6sche<br>
|
||||||
|
<br>
|
||||||
|
</font></b><font face=3D"Arial, Helvetica">Die Hasen klagten einst =FCber
|
||||||
|
ihre mi=DFliche 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 =E4rger als der Tod selbst.
|
||||||
|
Auf, la=DFt uns ein f=FCr allemal sterben." <br>
|
||||||
|
<br>
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au=
|
||||||
|
fs
|
||||||
|
schnellste untertauchten. <br>
|
||||||
|
<br>
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das
|
||||||
|
Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr
|
||||||
|
seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als
|
||||||
|
wir." <br>
|
||||||
|
<br>
|
||||||
|
</font></html>
|
||||||
|
|
||||||
@@ -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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n\n"
|
||||||
|
},
|
||||||
|
"offset_header": 0,
|
||||||
|
"offset_body": 500,
|
||||||
|
"offset_end": 1499
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519003052.00a89c40@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
X-Priority: 2 (High)
|
|
||||||
Date: Fri, 19 May 2000 00:31:00 -0400
|
|
||||||
To: Heinz =?iso-8859-1?Q?M=FCller?= <mueller@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: text/html; charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<font face=3D"Arial, Helvetica" size=3D5 color=3D"#0000FF"><b>Die Hasen und =
|
|
||||||
die
|
|
||||||
Fr=F6sche<br>
|
|
||||||
<br>
|
|
||||||
</font></b><font face=3D"Arial, Helvetica">Die Hasen klagten einst =FCber
|
|
||||||
ihre mi=DFliche 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 =E4rger als der Tod selbst.
|
|
||||||
Auf, la=DFt uns ein f=FCr allemal sterben." <br>
|
|
||||||
<br>
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au=
|
|
||||||
fs
|
|
||||||
schnellste untertauchten. <br>
|
|
||||||
<br>
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das
|
|
||||||
Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr
|
|
||||||
seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als
|
|
||||||
wir." <br>
|
|
||||||
<br>
|
|
||||||
</font></html>
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz Müller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com"
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "html",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 0,
|
|
||||||
"minute": 31,
|
|
||||||
"second": 0,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "2 (High)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
},
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 122,
|
|
||||||
"end": 170
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 181,
|
|
||||||
"end": 192
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 197,
|
|
||||||
"end": 231
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 234,
|
|
||||||
"end": 290
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 295,
|
|
||||||
"end": 332
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 340,
|
|
||||||
"end": 387
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 400,
|
|
||||||
"end": 406
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 419,
|
|
||||||
"end": 453
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 479,
|
|
||||||
"end": 498
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Html": {
|
|
||||||
"body": "<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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 500,
|
|
||||||
"offset_end": 1499
|
|
||||||
}
|
|
||||||
@@ -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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n"
|
||||||
|
},
|
||||||
|
"offset_header": 1488,
|
||||||
|
"offset_body": 1582,
|
||||||
|
"offset_end": 2579
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519002557.00a88870@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
X-Priority: 2 (High)
|
||||||
|
Date: Fri, 19 May 2000 00:29:55 -0400
|
||||||
|
To: Heinz =?iso-8859-1?Q?M=FCller?= <mueller@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: multipart/alternative;
|
||||||
|
boundary="=====================_714967308==_.ALT"
|
||||||
|
|
||||||
|
--=====================_714967308==_.ALT
|
||||||
|
Content-Type: text/plain; charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
Die Hasen und die Fr=F6sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =E4rger als der=
|
||||||
|
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie=
|
||||||
|
aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
||||||
|
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=
|
||||||
|
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
||||||
|
|
||||||
|
|
||||||
|
--=====================_714967308==_.ALT
|
||||||
|
Content-Type: text/html; charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<font face=3D"Arial, Helvetica" size=3D5 color=3D"#0000FF"><b>Die Hasen und =
|
||||||
|
die
|
||||||
|
Fr=F6sche<br>
|
||||||
|
<br>
|
||||||
|
</font></b><font face=3D"Arial, Helvetica">Die Hasen klagten einst =FCber
|
||||||
|
ihre mi=DFliche 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 =E4rger als der Tod selbst.
|
||||||
|
Auf, la=DFt uns ein f=FCr allemal sterben." <br>
|
||||||
|
<br>
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au=
|
||||||
|
fs
|
||||||
|
schnellste untertauchten. <br>
|
||||||
|
<br>
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das
|
||||||
|
Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr
|
||||||
|
seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als
|
||||||
|
wir." <br>
|
||||||
|
<br>
|
||||||
|
</font></html>
|
||||||
|
|
||||||
|
--=====================_714967308==_.ALT--
|
||||||
|
|
||||||
@@ -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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n"
|
||||||
|
},
|
||||||
|
"offset_header": 1488,
|
||||||
|
"offset_body": 1582,
|
||||||
|
"offset_end": 2579
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519002557.00a88870@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
X-Priority: 2 (High)
|
|
||||||
Date: Fri, 19 May 2000 00:29:55 -0400
|
|
||||||
To: Heinz =?iso-8859-1?Q?M=FCller?= <mueller@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: multipart/alternative;
|
|
||||||
boundary="=====================_714967308==_.ALT"
|
|
||||||
|
|
||||||
--=====================_714967308==_.ALT
|
|
||||||
Content-Type: text/plain; charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
Die Hasen und die Fr=F6sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =E4rger als der=
|
|
||||||
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie=
|
|
||||||
aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
|
||||||
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=
|
|
||||||
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
|
||||||
|
|
||||||
|
|
||||||
--=====================_714967308==_.ALT
|
|
||||||
Content-Type: text/html; charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<font face=3D"Arial, Helvetica" size=3D5 color=3D"#0000FF"><b>Die Hasen und =
|
|
||||||
die
|
|
||||||
Fr=F6sche<br>
|
|
||||||
<br>
|
|
||||||
</font></b><font face=3D"Arial, Helvetica">Die Hasen klagten einst =FCber
|
|
||||||
ihre mi=DFliche 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 =E4rger als der Tod selbst.
|
|
||||||
Auf, la=DFt uns ein f=FCr allemal sterben." <br>
|
|
||||||
<br>
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au=
|
|
||||||
fs
|
|
||||||
schnellste untertauchten. <br>
|
|
||||||
<br>
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das
|
|
||||||
Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr
|
|
||||||
seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als
|
|
||||||
wir." <br>
|
|
||||||
<br>
|
|
||||||
</font></html>
|
|
||||||
|
|
||||||
--=====================_714967308==_.ALT--
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 0,
|
|
||||||
"minute": 29,
|
|
||||||
"second": 55,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519002557.00a88870@pop.example.com"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz Müller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "multipart",
|
|
||||||
"c_subtype": "alternative",
|
|
||||||
"attributes": {
|
|
||||||
"boundary": "=====================_714967308==_.ALT"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "2 (High)"
|
|
||||||
},
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 122,
|
|
||||||
"end": 170
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 181,
|
|
||||||
"end": 192
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 197,
|
|
||||||
"end": 231
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 234,
|
|
||||||
"end": 290
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 295,
|
|
||||||
"end": 332
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 340,
|
|
||||||
"end": 387
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 400,
|
|
||||||
"end": 406
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 419,
|
|
||||||
"end": 496
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"headers": {
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Html": {
|
|
||||||
"headers": {
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "html",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"body": "<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; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben." <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"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir." <br>\n<br>\n</font></html>\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"List": [
|
|
||||||
{
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Part": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 498,
|
|
||||||
"offset_end": 2623
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519011207.00a8cd70@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
X-Priority: 5 (Lowest)
|
||||||
|
Date: Fri, 19 May 2000 01:13:19 -0400
|
||||||
|
To: Joe Blow <blow@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: The Hare and the Tortoise
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset="us-ascii"
|
||||||
|
|
||||||
|
|
||||||
|
The Hare and the Tortoise
|
||||||
|
|
||||||
|
A 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.
|
||||||
|
|
||||||
|
Slow but steady wins the race.
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519011207.00a8cd70@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
X-Priority: 5 (Lowest)
|
|
||||||
Date: Fri, 19 May 2000 01:13:19 -0400
|
|
||||||
To: Joe Blow <blow@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: The Hare and the Tortoise
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset="us-ascii"
|
|
||||||
|
|
||||||
|
|
||||||
The Hare and the Tortoise
|
|
||||||
|
|
||||||
A 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.
|
|
||||||
|
|
||||||
Slow but steady wins the race.
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"subject": {
|
|
||||||
"Text": "The Hare and the Tortoise"
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 1,
|
|
||||||
"minute": 13,
|
|
||||||
"second": 19,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "us-ascii"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Joe Blow",
|
|
||||||
"address": "blow@example.com"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "5 (Lowest)"
|
|
||||||
},
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 122,
|
|
||||||
"end": 170
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 181,
|
|
||||||
"end": 194
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 199,
|
|
||||||
"end": 233
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 236,
|
|
||||||
"end": 266
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 271,
|
|
||||||
"end": 308
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 316,
|
|
||||||
"end": 344
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 357,
|
|
||||||
"end": 363
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 376,
|
|
||||||
"end": 409
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race. \r\n\r\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 413,
|
|
||||||
"offset_end": 1177
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: =?utf-7?Q?Heinz_M+APw-ller?= <mueller@example.com>
|
||||||
|
Subject: =?utf-7?Q?Die_Hasen_und_die_Fr+APY-sche_=28Microsoft_Outlook_00=29?=
|
||||||
|
Date: Wed, 17 May 2000 19:20:24 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="utf-7"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
Die Hasen und die Fr+APY-sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst +APw-ber ihre mi+AN8-liche Lage+ADs- +ACI-wir =
|
||||||
|
leben+ACI-, sprach ein Redner, +ACI-in steter Furcht vor Menschen und =
|
||||||
|
Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere+ACE- =
|
||||||
|
Unsere stete Angst ist +AOQ-rger als der Tod selbst. Auf, la+AN8-t uns =
|
||||||
|
ein f+APw-r allemal sterben.+ACI-=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers+AOQ-ufen+ADs- sie eilten =
|
||||||
|
ihm zu+ADs- allein das au+AN8-erordentliche Get+APY-se und ihre =
|
||||||
|
wunderbare Gestalt erschreckte eine Menge Fr+APY-sche, die am Ufer =
|
||||||
|
sa+AN8-en, so sehr, da+AN8- sie aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
+ACI-Halt+ACI-, rief nun eben dieser Sprecher, +ACI-wir wollen das =
|
||||||
|
Ers+AOQ-ufen noch ein wenig aufschieben, denn auch uns f+APw-rchten, wie =
|
||||||
|
ihr seht, einige Tiere, welche also wohl noch ungl+APw-cklicher sein =
|
||||||
|
m+APw-ssen als wir.+ACI-=20
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: =?utf-7?Q?Heinz_M+APw-ller?= <mueller@example.com>
|
|
||||||
Subject: =?utf-7?Q?Die_Hasen_und_die_Fr+APY-sche_=28Microsoft_Outlook_00=29?=
|
|
||||||
Date: Wed, 17 May 2000 19:20:24 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="utf-7"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
Die Hasen und die Fr+APY-sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst +APw-ber ihre mi+AN8-liche Lage+ADs- +ACI-wir =
|
|
||||||
leben+ACI-, sprach ein Redner, +ACI-in steter Furcht vor Menschen und =
|
|
||||||
Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere+ACE- =
|
|
||||||
Unsere stete Angst ist +AOQ-rger als der Tod selbst. Auf, la+AN8-t uns =
|
|
||||||
ein f+APw-r allemal sterben.+ACI-=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers+AOQ-ufen+ADs- sie eilten =
|
|
||||||
ihm zu+ADs- allein das au+AN8-erordentliche Get+APY-se und ihre =
|
|
||||||
wunderbare Gestalt erschreckte eine Menge Fr+APY-sche, die am Ufer =
|
|
||||||
sa+AN8-en, so sehr, da+AN8- sie aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
+ACI-Halt+ACI-, rief nun eben dieser Sprecher, +ACI-wir wollen das =
|
|
||||||
Ers+AOQ-ufen noch ein wenig aufschieben, denn auch uns f+APw-rchten, wie =
|
|
||||||
ihr seht, einige Tiere, welche also wohl noch ungl+APw-cklicher sein =
|
|
||||||
m+APw-ssen als wir.+ACI-=20
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 20,
|
|
||||||
"second": 24,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz Müller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "utf-7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
},
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 96
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 104,
|
|
||||||
"end": 175
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 180,
|
|
||||||
"end": 214
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 225,
|
|
||||||
"end": 275
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 288,
|
|
||||||
"end": 294
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 307,
|
|
||||||
"end": 339
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 365,
|
|
||||||
"end": 384
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 395,
|
|
||||||
"end": 408
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 426,
|
|
||||||
"end": 435
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 444,
|
|
||||||
"end": 497
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 508,
|
|
||||||
"end": 517
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 527,
|
|
||||||
"end": 575
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 577,
|
|
||||||
"offset_end": 1470
|
|
||||||
}
|
|
||||||
@@ -1,267 +1,239 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: "Joe Blow" <jblow@example.com>
|
|
||||||
Subject: Test message from Microsoft Outlook 00
|
|
||||||
Date: Wed, 17 May 2000 19:36:13 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: multipart/mixed;
|
|
||||||
boundary="----=_NextPart_000_0004_01BFC037.28F2FA90"
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
This is a multi-part message in MIME format.
|
|
||||||
|
|
||||||
------=_NextPart_000_0004_01BFC037.28F2FA90
|
|
||||||
Content-Type: image/png;
|
|
||||||
name="blueball.png"
|
|
||||||
Content-Transfer-Encoding: base64
|
|
||||||
Content-Disposition: attachment;
|
|
||||||
filename="blueball.png"
|
|
||||||
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA
|
|
||||||
CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ
|
|
||||||
MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO
|
|
||||||
5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1
|
|
||||||
5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
|
||||||
MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb
|
|
||||||
L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P
|
|
||||||
yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC
|
|
||||||
UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm
|
|
||||||
T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS
|
|
||||||
GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B
|
|
||||||
1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD
|
|
||||||
/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz
|
|
||||||
O7wAAAAASUVORK5CYII=
|
|
||||||
|
|
||||||
------=_NextPart_000_0004_01BFC037.28F2FA90
|
|
||||||
Content-Type: image/png;
|
|
||||||
name="redball.png"
|
|
||||||
Content-Transfer-Encoding: base64
|
|
||||||
Content-Disposition: attachment;
|
|
||||||
filename="redball.png"
|
|
||||||
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
|
|
||||||
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
|
|
||||||
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
|
|
||||||
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
|
|
||||||
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
|
|
||||||
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
|
|
||||||
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
|
|
||||||
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
|
|
||||||
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
|
|
||||||
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
|
|
||||||
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
|
|
||||||
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
|
|
||||||
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
|
||||||
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
|
|
||||||
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
|
|
||||||
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
|
|
||||||
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
|
|
||||||
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
|
|
||||||
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
|
|
||||||
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
|
|
||||||
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
|
|
||||||
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
|
|
||||||
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
|
|
||||||
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|
||||||
|
|
||||||
------=_NextPart_000_0004_01BFC037.28F2FA90--
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
{
|
||||||
"headers_rfc": {
|
"html_body": [],
|
||||||
"to": {
|
"text_body": [],
|
||||||
"Address": {
|
|
||||||
"name": "Joe Blow",
|
|
||||||
"address": "jblow@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 36,
|
|
||||||
"second": 13,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "multipart",
|
|
||||||
"c_subtype": "mixed",
|
|
||||||
"attributes": {
|
|
||||||
"boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Test message from Microsoft Outlook 00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 76
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 84,
|
|
||||||
"end": 125
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 130,
|
|
||||||
"end": 164
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 175,
|
|
||||||
"end": 225
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 238,
|
|
||||||
"end": 244
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 257,
|
|
||||||
"end": 331
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 342,
|
|
||||||
"end": 355
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 373,
|
|
||||||
"end": 382
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 391,
|
|
||||||
"end": 444
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 455,
|
|
||||||
"end": 464
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 474,
|
|
||||||
"end": 522
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attachments": [
|
"attachments": [
|
||||||
0,
|
1,
|
||||||
1
|
2
|
||||||
],
|
],
|
||||||
"parts": [
|
"parts": [
|
||||||
{
|
{
|
||||||
"Binary": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_transfer_encoding": {
|
"name": {
|
||||||
"Text": "base64"
|
"Rfc": "from"
|
||||||
},
|
},
|
||||||
"content_disposition": {
|
"value": {
|
||||||
"ContentType": {
|
"Address": {
|
||||||
"c_type": "attachment",
|
"name": "Doug Sauder",
|
||||||
"attributes": {
|
"address": "doug@example.com"
|
||||||
"filename": "blueball.png"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_type": {
|
"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": 36,
|
||||||
|
"second": 13,
|
||||||
|
"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": "NDBBIAKOPKHFGPLCODIGOEKECHAA.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": "mixed",
|
||||||
|
"attributes": [
|
||||||
|
[
|
||||||
|
"boundary",
|
||||||
|
"----=_NextPart_000_0004_01BFC037.28F2FA90"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"offset_field": 244,
|
||||||
|
"offset_start": 257,
|
||||||
|
"offset_end": 331
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "3 (Normal)"
|
||||||
|
},
|
||||||
|
"offset_field": 331,
|
||||||
|
"offset_start": 342,
|
||||||
|
"offset_end": 355
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MSMail-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 355,
|
||||||
|
"offset_start": 373,
|
||||||
|
"offset_end": 382
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Mailer"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
||||||
|
},
|
||||||
|
"offset_field": 382,
|
||||||
|
"offset_start": 391,
|
||||||
|
"offset_end": 444
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "Importance"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 444,
|
||||||
|
"offset_start": 455,
|
||||||
|
"offset_end": 464
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MimeOLE"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
||||||
|
},
|
||||||
|
"offset_field": 464,
|
||||||
|
"offset_start": 474,
|
||||||
|
"offset_end": 522
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Multipart": [
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"offset_header": 0,
|
||||||
|
"offset_body": 524,
|
||||||
|
"offset_end": 4809
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "image",
|
"c_type": "image",
|
||||||
"c_subtype": "png",
|
"c_subtype": "png",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"name": "blueball.png"
|
[
|
||||||
}
|
"name",
|
||||||
|
"blueball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"offset_field": 617,
|
||||||
|
"offset_start": 630,
|
||||||
|
"offset_end": 665
|
||||||
},
|
},
|
||||||
"body": [
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "base64"
|
||||||
|
},
|
||||||
|
"offset_field": 665,
|
||||||
|
"offset_start": 691,
|
||||||
|
"offset_end": 700
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_disposition"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"ContentType": {
|
||||||
|
"c_type": "attachment",
|
||||||
|
"c_subtype": null,
|
||||||
|
"attributes": [
|
||||||
|
[
|
||||||
|
"filename",
|
||||||
|
"blueball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"offset_field": 700,
|
||||||
|
"offset_start": 720,
|
||||||
|
"offset_end": 760
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Binary": [
|
||||||
137,
|
137,
|
||||||
80,
|
80,
|
||||||
78,
|
78,
|
||||||
@@ -1588,33 +1560,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|||||||
96,
|
96,
|
||||||
130
|
130
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"offset_header": 617,
|
||||||
|
"offset_body": 762,
|
||||||
|
"offset_end": 2578
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Binary": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_type": {
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "image",
|
"c_type": "image",
|
||||||
"c_subtype": "png",
|
"c_subtype": "png",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"name": "redball.png"
|
[
|
||||||
}
|
"name",
|
||||||
|
"redball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_transfer_encoding": {
|
"offset_field": 2625,
|
||||||
|
"offset_start": 2638,
|
||||||
|
"offset_end": 2672
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"Text": "base64"
|
"Text": "base64"
|
||||||
},
|
},
|
||||||
"content_disposition": {
|
"offset_field": 2672,
|
||||||
|
"offset_start": 2698,
|
||||||
|
"offset_end": 2707
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_disposition"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "attachment",
|
"c_type": "attachment",
|
||||||
"attributes": {
|
"c_subtype": null,
|
||||||
"filename": "redball.png"
|
"attributes": [
|
||||||
}
|
[
|
||||||
|
"filename",
|
||||||
|
"redball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"offset_field": 2707,
|
||||||
"body": [
|
"offset_start": 2727,
|
||||||
|
"offset_end": 2766
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Binary": [
|
||||||
137,
|
137,
|
||||||
80,
|
80,
|
||||||
78,
|
78,
|
||||||
@@ -3069,20 +3076,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|||||||
96,
|
96,
|
||||||
130
|
130
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"List": [
|
|
||||||
{
|
|
||||||
"Part": 0
|
|
||||||
},
|
},
|
||||||
{
|
"offset_header": 2625,
|
||||||
"Part": 1
|
"offset_body": 2768,
|
||||||
}
|
"offset_end": 4760
|
||||||
]
|
}
|
||||||
},
|
]
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 524,
|
|
||||||
"offset_end": 4807
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: "Joe Blow" <jblow@example.com>
|
||||||
|
Subject: Test message from Microsoft Outlook 00
|
||||||
|
Date: Wed, 17 May 2000 19:36:13 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: multipart/mixed;
|
||||||
|
boundary="----=_NextPart_000_0004_01BFC037.28F2FA90"
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
This is a multi-part message in MIME format.
|
||||||
|
|
||||||
|
------=_NextPart_000_0004_01BFC037.28F2FA90
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="blueball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="blueball.png"
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA
|
||||||
|
CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ
|
||||||
|
MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO
|
||||||
|
5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1
|
||||||
|
5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb
|
||||||
|
L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P
|
||||||
|
yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC
|
||||||
|
UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm
|
||||||
|
T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS
|
||||||
|
GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B
|
||||||
|
1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD
|
||||||
|
/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz
|
||||||
|
O7wAAAAASUVORK5CYII=
|
||||||
|
|
||||||
|
------=_NextPart_000_0004_01BFC037.28F2FA90
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="redball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="redball.png"
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
|
||||||
|
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
|
||||||
|
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
|
||||||
|
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
|
||||||
|
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
|
||||||
|
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
|
||||||
|
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
|
||||||
|
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
|
||||||
|
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
|
||||||
|
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
|
||||||
|
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
|
||||||
|
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
|
||||||
|
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
|
||||||
|
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
|
||||||
|
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
|
||||||
|
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
|
||||||
|
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
|
||||||
|
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
|
||||||
|
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
|
||||||
|
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
|
||||||
|
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
|
||||||
|
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
|
||||||
|
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
||||||
|
|
||||||
|
------=_NextPart_000_0004_01BFC037.28F2FA90--
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= <schmuergen@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
||||||
|
Date: Wed, 17 May 2000 19:15:35 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
Die Hasen und die Fr=F6sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =
|
||||||
|
=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; =
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt =
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF =
|
||||||
|
sie aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch =
|
||||||
|
ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige =
|
||||||
|
Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= <schmuergen@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
|
||||||
Date: Wed, 17 May 2000 19:15:35 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
Die Hasen und die Fr=F6sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =
|
|
||||||
=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; =
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt =
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF =
|
|
||||||
sie aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch =
|
|
||||||
ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige =
|
|
||||||
Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Jürgen Schmürgen",
|
|
||||||
"address": "schmuergen@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 15,
|
|
||||||
"second": 35,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 112
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 120,
|
|
||||||
"end": 194
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 199,
|
|
||||||
"end": 233
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 244,
|
|
||||||
"end": 294
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 307,
|
|
||||||
"end": 313
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 326,
|
|
||||||
"end": 363
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 389,
|
|
||||||
"end": 408
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 419,
|
|
||||||
"end": 432
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 450,
|
|
||||||
"end": 459
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 468,
|
|
||||||
"end": 521
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 532,
|
|
||||||
"end": 541
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 551,
|
|
||||||
"end": 599
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 601,
|
|
||||||
"offset_end": 1410
|
|
||||||
}
|
|
||||||
@@ -1,345 +1,288 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: =?iso-8859-1?Q?Heinz_M=FCller?= <mueller@example.com>
|
|
||||||
Subject: Test message from Microsoft Outlook 00
|
|
||||||
Date: Wed, 17 May 2000 19:32:47 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: multipart/mixed;
|
|
||||||
boundary="----=_NextPart_000_0002_01BFC036.AE309650"
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
This is a multi-part message in MIME format.
|
|
||||||
|
|
||||||
------=_NextPart_000_0002_01BFC036.AE309650
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
|
|
||||||
The Hare and the Tortoise=20
|
|
||||||
=20
|
|
||||||
A 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. =20
|
|
||||||
=20
|
|
||||||
Slow but steady wins the race. =20
|
|
||||||
|
|
||||||
------=_NextPart_000_0002_01BFC036.AE309650
|
|
||||||
Content-Type: image/png;
|
|
||||||
name="blueball.png"
|
|
||||||
Content-Transfer-Encoding: base64
|
|
||||||
Content-Disposition: attachment;
|
|
||||||
filename="blueball.png"
|
|
||||||
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA
|
|
||||||
CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ
|
|
||||||
MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO
|
|
||||||
5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1
|
|
||||||
5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
|
||||||
MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb
|
|
||||||
L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P
|
|
||||||
yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC
|
|
||||||
UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm
|
|
||||||
T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS
|
|
||||||
GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B
|
|
||||||
1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD
|
|
||||||
/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz
|
|
||||||
O7wAAAAASUVORK5CYII=
|
|
||||||
|
|
||||||
------=_NextPart_000_0002_01BFC036.AE309650
|
|
||||||
Content-Type: image/png;
|
|
||||||
name="greenball.png"
|
|
||||||
Content-Transfer-Encoding: base64
|
|
||||||
Content-Disposition: attachment;
|
|
||||||
filename="greenball.png"
|
|
||||||
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAAAEAAAGAAAIQAA
|
|
||||||
CAAAMQAAQgAAUgAAWgAASgAIYwAIcwAIewAQjAAIawAAOQAAYwAQlAAQnAAhpQAQpQAhrQBCvRhj
|
|
||||||
xjFjxjlSxiEpzgAYvQAQrQAYrQAhvQCU1mOt1nuE1lJK3hgh1gAYxgAYtQAAKQBCzhDO55Te563G
|
|
||||||
55SU52NS5yEh3gAYzgBS3iGc52vW75y974yE71JC7xCt73ul3nNa7ykh5wAY1gAx5wBS7yFr7zlK
|
|
||||||
7xgp5wAp7wAx7wAIhAAQtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAp1fnZAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
|
||||||
MT1evmgAAAFtSURBVHicddJtV8IgFAdwD2zIgMEE1+NcqdsoK+m5tCyz7/+ZiLmHsyzvq53zO/cy
|
|
||||||
+N9ery1bVe9PWQA9z4MQ+H8Yoj7GASZ95IHfaBGmLOSchyIgyOu22mgQSjUcDuNYcoGjLiLK1cHh
|
|
||||||
0fHJaTKKOcMItgYxT89OzsfjyTTLC8UF0c2ZNmKquJhczq6ub+YmSVUYRF59GeDastu7+9nD41Nm
|
|
||||||
kiJ2jc2J3kAWZ9Pr55fH18XSmRuKUTXUaqHy7O19tfr4NFle/w3YDrWRUIlZrL/W86XJkyJVG9Ea
|
|
||||||
EjIx2XyZmZJGioeUaL+2AY8TY8omR6nkLKhu70zjUKVJXsp3quS2DVSJWNh3zzJKCyexI0ZxBP3a
|
|
||||||
fE0ElyqOlZJyw8r3BE2SFiJCyxA434SCkg65RhdeQBljQtCg39LWrA90RDDG1EWrYUO23hMANUKR
|
|
||||||
Rl61E529cR++D2G5LK002dr/qrcfu9u0V3bxn/XdhR/NYeeN0ggsLAAAACV0RVh0Q29tbWVudABj
|
|
||||||
bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
|
|
||||||
|
|
||||||
------=_NextPart_000_0002_01BFC036.AE309650
|
|
||||||
Content-Type: image/png;
|
|
||||||
name="redball.png"
|
|
||||||
Content-Transfer-Encoding: base64
|
|
||||||
Content-Disposition: attachment;
|
|
||||||
filename="redball.png"
|
|
||||||
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
|
|
||||||
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
|
|
||||||
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
|
|
||||||
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
|
|
||||||
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
|
|
||||||
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
|
|
||||||
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
|
|
||||||
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
|
|
||||||
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
|
|
||||||
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
|
|
||||||
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
|
|
||||||
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
|
|
||||||
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
|
||||||
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
|
|
||||||
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
|
|
||||||
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
|
|
||||||
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
|
|
||||||
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
|
|
||||||
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
|
|
||||||
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
|
|
||||||
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
|
|
||||||
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
|
|
||||||
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
|
|
||||||
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|
||||||
|
|
||||||
------=_NextPart_000_0002_01BFC036.AE309650--
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
{
|
||||||
"headers_rfc": {
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz Müller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 32,
|
|
||||||
"second": 47,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "multipart",
|
|
||||||
"c_subtype": "mixed",
|
|
||||||
"attributes": {
|
|
||||||
"boundary": "----=_NextPart_000_0002_01BFC036.AE309650"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Test message from Microsoft Outlook 00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 99
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 107,
|
|
||||||
"end": 148
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 153,
|
|
||||||
"end": 187
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 198,
|
|
||||||
"end": 248
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 261,
|
|
||||||
"end": 267
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 280,
|
|
||||||
"end": 354
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 365,
|
|
||||||
"end": 378
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 396,
|
|
||||||
"end": 405
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 414,
|
|
||||||
"end": 467
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 478,
|
|
||||||
"end": 487
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 497,
|
|
||||||
"end": 545
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
"html_body": [
|
||||||
0
|
1
|
||||||
],
|
],
|
||||||
"text_body": [
|
"text_body": [
|
||||||
0
|
1
|
||||||
],
|
],
|
||||||
"attachments": [
|
"attachments": [
|
||||||
1,
|
|
||||||
2,
|
2,
|
||||||
3
|
3,
|
||||||
|
4
|
||||||
],
|
],
|
||||||
"parts": [
|
"parts": [
|
||||||
{
|
{
|
||||||
"Text": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_type": {
|
"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": 99
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "subject"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Test message from Microsoft Outlook 00"
|
||||||
|
},
|
||||||
|
"offset_field": 99,
|
||||||
|
"offset_start": 107,
|
||||||
|
"offset_end": 148
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "date"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"DateTime": {
|
||||||
|
"year": 2000,
|
||||||
|
"month": 5,
|
||||||
|
"day": 17,
|
||||||
|
"hour": 19,
|
||||||
|
"minute": 32,
|
||||||
|
"second": 47,
|
||||||
|
"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": "NDBBIAKOPKHFGPLCODIGGEKECHAA.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": "multipart",
|
||||||
|
"c_subtype": "mixed",
|
||||||
|
"attributes": [
|
||||||
|
[
|
||||||
|
"boundary",
|
||||||
|
"----=_NextPart_000_0002_01BFC036.AE309650"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"offset_field": 267,
|
||||||
|
"offset_start": 280,
|
||||||
|
"offset_end": 354
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "3 (Normal)"
|
||||||
|
},
|
||||||
|
"offset_field": 354,
|
||||||
|
"offset_start": 365,
|
||||||
|
"offset_end": 378
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MSMail-Priority"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 378,
|
||||||
|
"offset_start": 396,
|
||||||
|
"offset_end": 405
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-Mailer"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
||||||
|
},
|
||||||
|
"offset_field": 405,
|
||||||
|
"offset_start": 414,
|
||||||
|
"offset_end": 467
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "Importance"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Normal"
|
||||||
|
},
|
||||||
|
"offset_field": 467,
|
||||||
|
"offset_start": 478,
|
||||||
|
"offset_end": 487
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Other": "X-MimeOLE"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
||||||
|
},
|
||||||
|
"offset_field": 487,
|
||||||
|
"offset_start": 497,
|
||||||
|
"offset_end": 545
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Multipart": [
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"offset_header": 0,
|
||||||
|
"offset_body": 547,
|
||||||
|
"offset_end": 7747
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "text",
|
"c_type": "text",
|
||||||
"c_subtype": "plain",
|
"c_subtype": "plain",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"charset": "iso-8859-1"
|
[
|
||||||
}
|
"charset",
|
||||||
|
"iso-8859-1"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_transfer_encoding": {
|
"offset_field": 640,
|
||||||
"Text": "quoted-printable"
|
"offset_start": 653,
|
||||||
}
|
"offset_end": 690
|
||||||
},
|
},
|
||||||
"body": "\nThe Hare and the Tortoise \n \nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \n \nSlow but steady wins the race. \n"
|
{
|
||||||
}
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "quoted-printable"
|
||||||
|
},
|
||||||
|
"offset_field": 690,
|
||||||
|
"offset_start": 716,
|
||||||
|
"offset_end": 735
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Text": "\nThe Hare and the Tortoise \n \nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. \n \nSlow but steady wins the race. \n"
|
||||||
|
},
|
||||||
|
"offset_header": 640,
|
||||||
|
"offset_body": 737,
|
||||||
|
"offset_end": 1536
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Binary": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_type": {
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "image",
|
"c_type": "image",
|
||||||
"c_subtype": "png",
|
"c_subtype": "png",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"name": "blueball.png"
|
[
|
||||||
}
|
"name",
|
||||||
|
"blueball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_disposition": {
|
"offset_field": 1583,
|
||||||
|
"offset_start": 1596,
|
||||||
|
"offset_end": 1631
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "base64"
|
||||||
|
},
|
||||||
|
"offset_field": 1631,
|
||||||
|
"offset_start": 1657,
|
||||||
|
"offset_end": 1666
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_disposition"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "attachment",
|
"c_type": "attachment",
|
||||||
"attributes": {
|
"c_subtype": null,
|
||||||
"filename": "blueball.png"
|
"attributes": [
|
||||||
}
|
[
|
||||||
|
"filename",
|
||||||
|
"blueball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_transfer_encoding": {
|
"offset_field": 1666,
|
||||||
"Text": "base64"
|
"offset_start": 1686,
|
||||||
}
|
"offset_end": 1726
|
||||||
},
|
}
|
||||||
"body": [
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Binary": [
|
||||||
137,
|
137,
|
||||||
80,
|
80,
|
||||||
78,
|
78,
|
||||||
@@ -1666,33 +1609,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|||||||
96,
|
96,
|
||||||
130
|
130
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"offset_header": 1583,
|
||||||
|
"offset_body": 1728,
|
||||||
|
"offset_end": 3544
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Binary": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_type": {
|
"name": {
|
||||||
|
"Rfc": "content_type"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "image",
|
"c_type": "image",
|
||||||
"c_subtype": "png",
|
"c_subtype": "png",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"name": "greenball.png"
|
[
|
||||||
}
|
"name",
|
||||||
|
"greenball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_disposition": {
|
"offset_field": 3591,
|
||||||
|
"offset_start": 3604,
|
||||||
|
"offset_end": 3640
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "base64"
|
||||||
|
},
|
||||||
|
"offset_field": 3640,
|
||||||
|
"offset_start": 3666,
|
||||||
|
"offset_end": 3675
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_disposition"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "attachment",
|
"c_type": "attachment",
|
||||||
"attributes": {
|
"c_subtype": null,
|
||||||
"filename": "greenball.png"
|
"attributes": [
|
||||||
}
|
[
|
||||||
|
"filename",
|
||||||
|
"greenball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_transfer_encoding": {
|
"offset_field": 3675,
|
||||||
"Text": "base64"
|
"offset_start": 3695,
|
||||||
}
|
"offset_end": 3736
|
||||||
},
|
}
|
||||||
"body": [
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Binary": [
|
||||||
137,
|
137,
|
||||||
80,
|
80,
|
||||||
78,
|
78,
|
||||||
@@ -2992,33 +2970,68 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|||||||
96,
|
96,
|
||||||
130
|
130
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"offset_header": 3591,
|
||||||
|
"offset_body": 3738,
|
||||||
|
"offset_end": 5516
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Binary": {
|
"headers": [
|
||||||
"headers": {
|
{
|
||||||
"content_disposition": {
|
"name": {
|
||||||
"ContentType": {
|
"Rfc": "content_type"
|
||||||
"c_type": "attachment",
|
|
||||||
"attributes": {
|
|
||||||
"filename": "redball.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"content_transfer_encoding": {
|
"value": {
|
||||||
"Text": "base64"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
"ContentType": {
|
||||||
"c_type": "image",
|
"c_type": "image",
|
||||||
"c_subtype": "png",
|
"c_subtype": "png",
|
||||||
"attributes": {
|
"attributes": [
|
||||||
"name": "redball.png"
|
[
|
||||||
}
|
"name",
|
||||||
|
"redball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"offset_field": 5563,
|
||||||
|
"offset_start": 5576,
|
||||||
|
"offset_end": 5610
|
||||||
},
|
},
|
||||||
"body": [
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_transfer_encoding"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"Text": "base64"
|
||||||
|
},
|
||||||
|
"offset_field": 5610,
|
||||||
|
"offset_start": 5636,
|
||||||
|
"offset_end": 5645
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"Rfc": "content_disposition"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"ContentType": {
|
||||||
|
"c_type": "attachment",
|
||||||
|
"c_subtype": null,
|
||||||
|
"attributes": [
|
||||||
|
[
|
||||||
|
"filename",
|
||||||
|
"redball.png"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"offset_field": 5645,
|
||||||
|
"offset_start": 5665,
|
||||||
|
"offset_end": 5704
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_encoding_problem": false,
|
||||||
|
"body": {
|
||||||
|
"Binary": [
|
||||||
137,
|
137,
|
||||||
80,
|
80,
|
||||||
78,
|
78,
|
||||||
@@ -4473,26 +4486,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
|||||||
96,
|
96,
|
||||||
130
|
130
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"offset_header": 5563,
|
||||||
|
"offset_body": 5706,
|
||||||
|
"offset_end": 7698
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"structure": {
|
|
||||||
"List": [
|
|
||||||
{
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Part": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Part": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Part": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 547,
|
|
||||||
"offset_end": 7745
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: =?iso-8859-1?Q?Heinz_M=FCller?= <mueller@example.com>
|
||||||
|
Subject: Test message from Microsoft Outlook 00
|
||||||
|
Date: Wed, 17 May 2000 19:32:47 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: multipart/mixed;
|
||||||
|
boundary="----=_NextPart_000_0002_01BFC036.AE309650"
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
This is a multi-part message in MIME format.
|
||||||
|
|
||||||
|
------=_NextPart_000_0002_01BFC036.AE309650
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
|
||||||
|
The Hare and the Tortoise=20
|
||||||
|
=20
|
||||||
|
A 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. =20
|
||||||
|
=20
|
||||||
|
Slow but steady wins the race. =20
|
||||||
|
|
||||||
|
------=_NextPart_000_0002_01BFC036.AE309650
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="blueball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="blueball.png"
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA
|
||||||
|
CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ
|
||||||
|
MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO
|
||||||
|
5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1
|
||||||
|
5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb
|
||||||
|
L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P
|
||||||
|
yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC
|
||||||
|
UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm
|
||||||
|
T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS
|
||||||
|
GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B
|
||||||
|
1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD
|
||||||
|
/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz
|
||||||
|
O7wAAAAASUVORK5CYII=
|
||||||
|
|
||||||
|
------=_NextPart_000_0002_01BFC036.AE309650
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="greenball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="greenball.png"
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAAAEAAAGAAAIQAA
|
||||||
|
CAAAMQAAQgAAUgAAWgAASgAIYwAIcwAIewAQjAAIawAAOQAAYwAQlAAQnAAhpQAQpQAhrQBCvRhj
|
||||||
|
xjFjxjlSxiEpzgAYvQAQrQAYrQAhvQCU1mOt1nuE1lJK3hgh1gAYxgAYtQAAKQBCzhDO55Te563G
|
||||||
|
55SU52NS5yEh3gAYzgBS3iGc52vW75y974yE71JC7xCt73ul3nNa7ykh5wAY1gAx5wBS7yFr7zlK
|
||||||
|
7xgp5wAp7wAx7wAIhAAQtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAp1fnZAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAFtSURBVHicddJtV8IgFAdwD2zIgMEE1+NcqdsoK+m5tCyz7/+ZiLmHsyzvq53zO/cy
|
||||||
|
+N9ery1bVe9PWQA9z4MQ+H8Yoj7GASZ95IHfaBGmLOSchyIgyOu22mgQSjUcDuNYcoGjLiLK1cHh
|
||||||
|
0fHJaTKKOcMItgYxT89OzsfjyTTLC8UF0c2ZNmKquJhczq6ub+YmSVUYRF59GeDastu7+9nD41Nm
|
||||||
|
kiJ2jc2J3kAWZ9Pr55fH18XSmRuKUTXUaqHy7O19tfr4NFle/w3YDrWRUIlZrL/W86XJkyJVG9Ea
|
||||||
|
EjIx2XyZmZJGioeUaL+2AY8TY8omR6nkLKhu70zjUKVJXsp3quS2DVSJWNh3zzJKCyexI0ZxBP3a
|
||||||
|
fE0ElyqOlZJyw8r3BE2SFiJCyxA434SCkg65RhdeQBljQtCg39LWrA90RDDG1EWrYUO23hMANUKR
|
||||||
|
Rl61E529cR++D2G5LK002dr/qrcfu9u0V3bxn/XdhR/NYeeN0ggsLAAAACV0RVh0Q29tbWVudABj
|
||||||
|
bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII=
|
||||||
|
|
||||||
|
------=_NextPart_000_0002_01BFC036.AE309650
|
||||||
|
Content-Type: image/png;
|
||||||
|
name="redball.png"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename="redball.png"
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa
|
||||||
|
AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0
|
||||||
|
AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM
|
||||||
|
AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm
|
||||||
|
f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB
|
||||||
|
AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2
|
||||||
|
AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH
|
||||||
|
AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC
|
||||||
|
AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe
|
||||||
|
AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs
|
||||||
|
AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV
|
||||||
|
AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM
|
||||||
|
AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu
|
||||||
|
MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK
|
||||||
|
iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ
|
||||||
|
29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW
|
||||||
|
SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+
|
||||||
|
d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q
|
||||||
|
m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV
|
||||||
|
tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw
|
||||||
|
HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5
|
||||||
|
QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd
|
||||||
|
tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5
|
||||||
|
IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg==
|
||||||
|
|
||||||
|
------=_NextPart_000_0002_01BFC036.AE309650--
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519010441.00a8d140@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
Disposition-Notification-To: <dwsauder@example.com>
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
X-Priority: 1 (Highest)
|
||||||
|
Date: Fri, 19 May 2000 01:06:18 -0400
|
||||||
|
To: =?iso-8859-1?Q?Jürgen?= =?iso-8859-1?Q?_Schmürgen?=
|
||||||
|
<jschmuergen@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Frösche?=
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
Die Hasen und die Fr=F6sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach ein=
|
||||||
|
=20
|
||||||
|
Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,=20
|
||||||
|
der Adler, ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als der=
|
||||||
|
=20
|
||||||
|
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=20
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
||||||
|
erschreckte=20
|
||||||
|
eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie aufs=
|
||||||
|
schnellste=20
|
||||||
|
untertauchten.
|
||||||
|
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
||||||
|
=20
|
||||||
|
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=20
|
||||||
|
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519010441.00a8d140@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
Disposition-Notification-To: <dwsauder@example.com>
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
X-Priority: 1 (Highest)
|
|
||||||
Date: Fri, 19 May 2000 01:06:18 -0400
|
|
||||||
To: =?iso-8859-1?Q?Jürgen?= =?iso-8859-1?Q?_Schmürgen?=
|
|
||||||
<jschmuergen@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Frösche?=
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
Die Hasen und die Fr=F6sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach ein=
|
|
||||||
=20
|
|
||||||
Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,=20
|
|
||||||
der Adler, ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als der=
|
|
||||||
=20
|
|
||||||
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=20
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
|
||||||
erschreckte=20
|
|
||||||
eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie aufs=
|
|
||||||
schnellste=20
|
|
||||||
untertauchten.
|
|
||||||
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
|
||||||
=20
|
|
||||||
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=20
|
|
||||||
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com"
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1",
|
|
||||||
"format": "flowed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Jürgen Schmürgen",
|
|
||||||
"address": "jschmuergen@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 1,
|
|
||||||
"minute": 6,
|
|
||||||
"second": 18,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"Disposition-Notification-To": {
|
|
||||||
"Text": "<dwsauder@example.com>"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "1 (Highest)"
|
|
||||||
},
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Disposition-Notification-To"
|
|
||||||
},
|
|
||||||
"start": 141,
|
|
||||||
"end": 166
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 175,
|
|
||||||
"end": 223
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 234,
|
|
||||||
"end": 248
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 253,
|
|
||||||
"end": 287
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 290,
|
|
||||||
"end": 373
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 378,
|
|
||||||
"end": 415
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 423,
|
|
||||||
"end": 468
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 481,
|
|
||||||
"end": 487
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 500,
|
|
||||||
"end": 550
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 576,
|
|
||||||
"end": 595
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein \nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, \nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der \nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; \nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein \nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, \nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 597,
|
|
||||||
"offset_end": 1422
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519010842.00a8c7f0@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
X-Priority: 1 (Highest)
|
||||||
|
Date: Fri, 19 May 2000 01:10:27 -0400
|
||||||
|
To: Heinz Müller <mueller@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: Die Hasen und die Frösche
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Die Hasen und die Frösche
|
||||||
|
|
||||||
|
Die 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."
|
||||||
|
|
||||||
|
In 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.
|
||||||
|
|
||||||
|
"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."
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519010842.00a8c7f0@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
X-Priority: 1 (Highest)
|
|
||||||
Date: Fri, 19 May 2000 01:10:27 -0400
|
|
||||||
To: Heinz Müller <mueller@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: Die Hasen und die Frösche
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Die Hasen und die Frösche
|
|
||||||
|
|
||||||
Die 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."
|
|
||||||
|
|
||||||
In 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.
|
|
||||||
|
|
||||||
"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."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "8bit"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 1,
|
|
||||||
"minute": 10,
|
|
||||||
"second": 27,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com"
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Fr�sche"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz M�ller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "1 (Highest)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 122,
|
|
||||||
"end": 170
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 181,
|
|
||||||
"end": 195
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 200,
|
|
||||||
"end": 234
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 237,
|
|
||||||
"end": 274
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 279,
|
|
||||||
"end": 316
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 324,
|
|
||||||
"end": 352
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 365,
|
|
||||||
"end": 371
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 384,
|
|
||||||
"end": 419
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 445,
|
|
||||||
"end": 452
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n\r\n\r\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 454,
|
|
||||||
"offset_end": 1203
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Message-Id: <4.2.0.58.20000519001217.00a85b60@pop.example.com>
|
||||||
|
X-Sender: dwsauder@pop.example.com (Unverified)
|
||||||
|
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
||||||
|
Date: Fri, 19 May 2000 00:17:39 -0400
|
||||||
|
To: =?iso-8859-1?Q?J=FCrgen?= =?iso-8859-1?Q?_Schm=FCrgen?=
|
||||||
|
<jschmuergen@example.com>
|
||||||
|
From: Doug Sauder <dwsauder@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
|
||||||
|
Die Hasen und die Fr=F6sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =E4rger als der=
|
||||||
|
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie=
|
||||||
|
aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
||||||
|
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=
|
||||||
|
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
Message-Id: <4.2.0.58.20000519001217.00a85b60@pop.example.com>
|
|
||||||
X-Sender: dwsauder@pop.example.com (Unverified)
|
|
||||||
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
|
|
||||||
Date: Fri, 19 May 2000 00:17:39 -0400
|
|
||||||
To: =?iso-8859-1?Q?J=FCrgen?= =?iso-8859-1?Q?_Schm=FCrgen?=
|
|
||||||
<jschmuergen@example.com>
|
|
||||||
From: Doug Sauder <dwsauder@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?=
|
|
||||||
Mime-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
Die Hasen und die Fr=F6sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =E4rger als der=
|
|
||||||
Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;=
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt=
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie=
|
|
||||||
aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein=
|
|
||||||
wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,=
|
|
||||||
welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche"
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com"
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "dwsauder@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Jürgen Schmürgen",
|
|
||||||
"address": "jschmuergen@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 19,
|
|
||||||
"hour": 0,
|
|
||||||
"minute": 17,
|
|
||||||
"second": 39,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58"
|
|
||||||
},
|
|
||||||
"X-Sender": {
|
|
||||||
"Text": "dwsauder@pop.example.com (Unverified)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 11,
|
|
||||||
"end": 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Sender"
|
|
||||||
},
|
|
||||||
"start": 73,
|
|
||||||
"end": 113
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 122,
|
|
||||||
"end": 170
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 175,
|
|
||||||
"end": 209
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 212,
|
|
||||||
"end": 299
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 304,
|
|
||||||
"end": 341
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 349,
|
|
||||||
"end": 396
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 409,
|
|
||||||
"end": 415
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 428,
|
|
||||||
"end": 463
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 489,
|
|
||||||
"end": 508
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 510,
|
|
||||||
"offset_end": 1321
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: =?Windows-1252?Q?Heinz_M=FCller?= <mueller@example.com>
|
||||||
|
Subject: =?Windows-1252?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
||||||
|
Date: Wed, 17 May 2000 19:30:20 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="Windows-1252"
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
Die Hasen und die Fr=F6sche
|
||||||
|
|
||||||
|
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =
|
||||||
|
=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
||||||
|
|
||||||
|
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; =
|
||||||
|
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt =
|
||||||
|
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF =
|
||||||
|
sie aufs schnellste untertauchten.=20
|
||||||
|
|
||||||
|
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch =
|
||||||
|
ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige =
|
||||||
|
Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: =?Windows-1252?Q?Heinz_M=FCller?= <mueller@example.com>
|
|
||||||
Subject: =?Windows-1252?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
|
||||||
Date: Wed, 17 May 2000 19:30:20 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="Windows-1252"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
Die Hasen und die Fr=F6sche
|
|
||||||
|
|
||||||
Die Hasen klagten einst =FCber ihre mi=DFliche 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 =
|
|
||||||
=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20
|
|
||||||
|
|
||||||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; =
|
|
||||||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt =
|
|
||||||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF =
|
|
||||||
sie aufs schnellste untertauchten.=20
|
|
||||||
|
|
||||||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch =
|
|
||||||
ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige =
|
|
||||||
Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 30,
|
|
||||||
"second": 20,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "quoted-printable"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "Windows-1252"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Heinz Müller",
|
|
||||||
"address": "mueller@example.com"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 101
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 109,
|
|
||||||
"end": 185
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 190,
|
|
||||||
"end": 224
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 235,
|
|
||||||
"end": 285
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 298,
|
|
||||||
"end": 304
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 317,
|
|
||||||
"end": 356
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 382,
|
|
||||||
"end": 401
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 412,
|
|
||||||
"end": 425
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 443,
|
|
||||||
"end": 452
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 461,
|
|
||||||
"end": 514
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 525,
|
|
||||||
"end": 534
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 544,
|
|
||||||
"end": 592
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 594,
|
|
||||||
"offset_end": 1401
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
From: "Doug Sauder" <doug@example.com>
|
||||||
|
To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= <schmuergen@example.com>
|
||||||
|
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
||||||
|
Date: Wed, 17 May 2000 19:13:51 -0400
|
||||||
|
Message-ID: <NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset="iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
X-Priority: 3 (Normal)
|
||||||
|
X-MSMail-Priority: Normal
|
||||||
|
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
||||||
|
Importance: Normal
|
||||||
|
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
||||||
|
|
||||||
|
Die Hasen und die Frösche
|
||||||
|
|
||||||
|
Die 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."
|
||||||
|
|
||||||
|
In 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.
|
||||||
|
|
||||||
|
"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."
|
||||||
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
From: "Doug Sauder" <doug@example.com>
|
|
||||||
To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= <schmuergen@example.com>
|
|
||||||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=
|
|
||||||
Date: Wed, 17 May 2000 19:13:51 -0400
|
|
||||||
Message-ID: <NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="iso-8859-1"
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
X-Priority: 3 (Normal)
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
|
|
||||||
Importance: Normal
|
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
|
|
||||||
|
|
||||||
Die Hasen und die Frösche
|
|
||||||
|
|
||||||
Die 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."
|
|
||||||
|
|
||||||
In 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.
|
|
||||||
|
|
||||||
"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."
|
|
||||||
|
|
||||||
|
|
||||||
---- EXPECTED STRUCTURE ----
|
|
||||||
{
|
|
||||||
"headers_rfc": {
|
|
||||||
"content_type": {
|
|
||||||
"ContentType": {
|
|
||||||
"c_type": "text",
|
|
||||||
"c_subtype": "plain",
|
|
||||||
"attributes": {
|
|
||||||
"charset": "iso-8859-1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"subject": {
|
|
||||||
"Text": "Die Hasen und die Frösche (Microsoft Outlook 00)"
|
|
||||||
},
|
|
||||||
"from": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Doug Sauder",
|
|
||||||
"address": "doug@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"Address": {
|
|
||||||
"name": "Jürgen Schmürgen",
|
|
||||||
"address": "schmuergen@example.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime_version": {
|
|
||||||
"Text": "1.0"
|
|
||||||
},
|
|
||||||
"message_id": {
|
|
||||||
"Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com"
|
|
||||||
},
|
|
||||||
"content_transfer_encoding": {
|
|
||||||
"Text": "8bit"
|
|
||||||
},
|
|
||||||
"date": {
|
|
||||||
"DateTime": {
|
|
||||||
"year": 2000,
|
|
||||||
"month": 5,
|
|
||||||
"day": 17,
|
|
||||||
"hour": 19,
|
|
||||||
"minute": 13,
|
|
||||||
"second": 51,
|
|
||||||
"tz_before_gmt": true,
|
|
||||||
"tz_hour": 4,
|
|
||||||
"tz_minute": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_other": {
|
|
||||||
"X-Priority": {
|
|
||||||
"Text": "3 (Normal)"
|
|
||||||
},
|
|
||||||
"X-MSMail-Priority": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-Mailer": {
|
|
||||||
"Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)"
|
|
||||||
},
|
|
||||||
"Importance": {
|
|
||||||
"Text": "Normal"
|
|
||||||
},
|
|
||||||
"X-MimeOLE": {
|
|
||||||
"Text": "Produced By Microsoft MimeOLE V5.00.2314.1300"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers_offsets": [
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "from"
|
|
||||||
},
|
|
||||||
"start": 5,
|
|
||||||
"end": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "to"
|
|
||||||
},
|
|
||||||
"start": 43,
|
|
||||||
"end": 112
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "subject"
|
|
||||||
},
|
|
||||||
"start": 120,
|
|
||||||
"end": 194
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "date"
|
|
||||||
},
|
|
||||||
"start": 199,
|
|
||||||
"end": 233
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "message_id"
|
|
||||||
},
|
|
||||||
"start": 244,
|
|
||||||
"end": 294
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "mime_version"
|
|
||||||
},
|
|
||||||
"start": 307,
|
|
||||||
"end": 313
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_type"
|
|
||||||
},
|
|
||||||
"start": 326,
|
|
||||||
"end": 363
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Rfc": "content_transfer_encoding"
|
|
||||||
},
|
|
||||||
"start": 389,
|
|
||||||
"end": 396
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Priority"
|
|
||||||
},
|
|
||||||
"start": 407,
|
|
||||||
"end": 420
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MSMail-Priority"
|
|
||||||
},
|
|
||||||
"start": 438,
|
|
||||||
"end": 447
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-Mailer"
|
|
||||||
},
|
|
||||||
"start": 456,
|
|
||||||
"end": 509
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "Importance"
|
|
||||||
},
|
|
||||||
"start": 520,
|
|
||||||
"end": 529
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"Other": "X-MimeOLE"
|
|
||||||
},
|
|
||||||
"start": 539,
|
|
||||||
"end": 587
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"html_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"text_body": [
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parts": [
|
|
||||||
{
|
|
||||||
"Text": {
|
|
||||||
"body": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"structure": {
|
|
||||||
"Part": 0
|
|
||||||
},
|
|
||||||
"offset_header": 0,
|
|
||||||
"offset_body": 589,
|
|
||||||
"offset_end": 1341
|
|
||||||
}
|
|
||||||
@@ -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> <BR>A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing: \"Though you be swift as the wind, I will beat you in a \nrace.\" The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal. On the day appointed for the race the two started \ntogether. The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course. The Hare, lying down by \nthe wayside, fell fast asleep. At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. <BR> <BR>Slow but steady wins the race. \n<BR></FONT></DIV></BODY></HTML>\n"
|
||||||
|
},
|
||||||
|
"offset_header": 1568,
|
||||||
|
"offset_body": 1664,
|
||||||
|
"offset_end": 2854
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user