❇️ content-length response header

main
_ 2020-10-27 21:33:03 -05:00
parent 4c03e6d32a
commit 9e3470d5b4
2 changed files with 7 additions and 3 deletions

View File

@ -122,6 +122,8 @@ async fn main () -> Result <(), Box <dyn Error>> {
f.seek (SeekFrom::Start (start)).await.unwrap ();
}
let file_md = f.metadata ().await.unwrap ();
tokio::spawn (async move {
//println! ("Opening file {:?}", path);
@ -150,7 +152,11 @@ async fn main () -> Result <(), Box <dyn Error>> {
});
let mut headers: HashMap <String, Vec <u8>> = Default::default ();
headers.insert (String::from ("x-its-a-header"), Vec::from (&b"wow"[..]));
//headers.insert (String::from ("x-its-a-header"), Vec::from (&b"wow"[..]));
if range_start.is_none () && range_end.is_none () {
headers.insert (String::from ("content-length"), file_md.len ().to_string ().into_bytes ());
}
let resp_parts = http_serde::ResponseParts {
status_code: http_serde::StatusCode::Ok,

View File

@ -1,3 +1 @@
- Figure out how to pack response status / headers into request body
- Byte range request header
- Content-Length response header