summaryrefslogtreecommitdiff
path: root/src/handler
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2026-03-05 00:53:59 -0500
committerJohn Turner <jturner.usa@gmail.com>2026-03-05 00:53:59 -0500
commit34c9316e052a48fa95374936801347755f40f3b7 (patch)
tree952a933177996e9e125f6e6571ecca8f02aa1574 /src/handler
parent92e8d4947de614a67fed6709a59365de98705b35 (diff)
downloadhttpd-34c9316e052a48fa95374936801347755f40f3b7.tar.gz
return content-length header when returning 404 in staticfile handler
Diffstat (limited to 'src/handler')
-rw-r--r--src/handler/staticfile.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/handler/staticfile.rs b/src/handler/staticfile.rs
index 871f414..969c4d7 100644
--- a/src/handler/staticfile.rs
+++ b/src/handler/staticfile.rs
@@ -43,11 +43,13 @@ impl Handle for StaticFile {
} else {
Ok(Response::builder()
.status(Status::NotFound)
+ .headers([("content-length", "0")])
.body(Body::Empty))
}
}
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => Ok(Response::builder()
.status(Status::NotFound)
+ .headers([("content-length", "0")])
.body(Body::Empty)),
Err(e) => Err(Error::Io(e))?,
},