Created a section closure
This commit is contained in:
parent
afcc9633ac
commit
a0f0999c8f
14
src/main.rs
14
src/main.rs
@ -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}\"><< Back</a>");
|
||||
let section = |stream: &mut TcpStream| {
|
||||
let _ = writeln!(stream, "<hr>");
|
||||
let _ = writeln!(stream, "<a href=\"/{parent_path}\"><< 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}\"><< 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}\"><< Back</a>");
|
||||
section(&mut stream);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user