Created a section closure

This commit is contained in:
p11 2023-11-20 22:22:50 +01:00
parent afcc9633ac
commit a0f0999c8f

View File

@ -508,8 +508,12 @@ fn handle_relative_connection(
.map(|(path, _)| path)
.unwrap_or_default();
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
let section = |stream: &mut TcpStream| {
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
};
section(&mut stream);
if let Some(pki_path) = pki_path {
if let Ok(pki_file) = File::open(pki_path) {
@ -569,8 +573,7 @@ fn handle_relative_connection(
convert_subheader(lines.map(|line| line.unwrap_or_default()), &mut stream, 1);
}
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
section(&mut stream);
} else {
unreachable!();
}
@ -596,6 +599,5 @@ fn handle_relative_connection(
let _ = writeln!(stream, "<fieldset><legend>{name}</legend>{text}</fieldset>");
}
let _ = writeln!(stream, "<hr>");
let _ = writeln!(stream, "<a href=\"/{parent_path}\">&lt;&lt; Back</a>");
section(&mut stream);
}