Skip to content

Commit 50d8ba7

Browse files
committed
fix HEAD content-length presence
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent ffa7468 commit 50d8ba7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,9 @@ async fn ax_get_file(
10291029

10301030
/* Usually HEAD is used to check if the file exists and range is supported */
10311031
if method == axum::http::Method::HEAD {
1032-
//println!("HEAD request, returning headers only");
1032+
if let Ok(val) = header::HeaderValue::from_str(&metadata.len().to_string()) {
1033+
headers.insert(header::CONTENT_LENGTH, val);
1034+
}
10331035
println!(
10341036
"{:?} 200 0 {} {} {} {}",
10351037
remote_addr, human_time, method, filepath, user_agent_str

0 commit comments

Comments
 (0)