server: include headers in debug output
This commit is contained in:
parent
714b057fdb
commit
7a32d5c630
@ -339,6 +339,10 @@ fn extract_unhandled(m: &ParsedMail) -> Result<Body, Error> {
|
||||
text: msg,
|
||||
}))
|
||||
}
|
||||
|
||||
// multipart/alternative defines multiple representations of the same message, and clients should
|
||||
// show the fanciest they can display. For this program, the priority is text/html, text/plain,
|
||||
// then give up.
|
||||
fn extract_alternative(m: &ParsedMail) -> Result<Body, Error> {
|
||||
for sp in &m.subparts {
|
||||
if sp.ctype.mimetype == "text/html" {
|
||||
@ -355,6 +359,8 @@ fn extract_alternative(m: &ParsedMail) -> Result<Body, Error> {
|
||||
Err("extract_alternative".into())
|
||||
}
|
||||
|
||||
// multipart/mixed defines multiple types of context all of which should be presented to the user
|
||||
// 'serially'.
|
||||
fn extract_mixed(m: &ParsedMail) -> Result<Body, Error> {
|
||||
for sp in &m.subparts {
|
||||
if sp.ctype.mimetype == "multipart/alternative" {
|
||||
@ -400,15 +406,18 @@ fn render_content_type_tree(m: &ParsedMail) -> String {
|
||||
let mut parts = Vec::new();
|
||||
let msg = format!("{} {}", "-".repeat(depth * WIDTH), m.ctype.mimetype);
|
||||
parts.push(msg);
|
||||
let indent = " ".repeat(depth * WIDTH);
|
||||
if !m.ctype.charset.is_empty() {
|
||||
parts.push(format!(
|
||||
"{} Character Set: {}",
|
||||
" ".repeat(depth * WIDTH),
|
||||
m.ctype.charset
|
||||
));
|
||||
parts.push(format!("{indent} Character Set: {}", m.ctype.charset));
|
||||
}
|
||||
for (k, v) in m.ctype.params.iter() {
|
||||
parts.push(format!("{} {k}: {v}", " ".repeat(depth * WIDTH),));
|
||||
parts.push(format!("{indent} {k}: {v}"));
|
||||
}
|
||||
if !m.headers.is_empty() {
|
||||
parts.push(format!("{indent} == headers =="));
|
||||
for h in &m.headers {
|
||||
parts.push(format!("{indent} {}: {}", h.get_key(), h.get_value()));
|
||||
}
|
||||
}
|
||||
for sp in &m.subparts {
|
||||
parts.push(render_rec(sp, depth + 1))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user