aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-27 06:03:33 +0000
committerFuwn <[email protected]>2022-03-27 06:03:33 +0000
commit97884a183f378fd996029cde769df2e974fff1eb (patch)
treebf270166bffb4622e3bb2e027707b71b05e2501d /src/lib.rs
parentrefactor(tokio): reexport main (diff)
downloadwindmark-97884a183f378fd996029cde769df2e974fff1eb.tar.xz
windmark-97884a183f378fd996029cde769df2e974fff1eb.zip
feat(response): respond with file
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0d201da..4ffabba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -314,13 +314,19 @@ impl Router {
.write_all(
format!(
"{}{}\r\n{}",
- response_status,
+ if response_status == 21 {
+ 20
+ } else {
+ response_status
+ },
match response_status {
- 20 => " text/gemini; charset=utf-8",
- _ => &*content,
+ 20 => " text/gemini; charset=utf-8".to_string(),
+ 21 => tree_magic::from_u8(&*content.as_bytes()),
+ _ => (&*content).to_string(),
},
match response_status {
20 => format!("{}{}{}", header, content, footer),
+ 21 => (&*content).to_string(),
_ => "".to_string(),
}
)