summaryrefslogtreecommitdiff
path: root/src/handler/staticfile.rs
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2026-03-05 01:46:40 -0500
committerJohn Turner <jturner.usa@gmail.com>2026-03-05 01:46:40 -0500
commitcb6f70f6908aaea46c5d6332d3deb9a4a83733aa (patch)
treeddd0ac4b489cd2bdcfc25f434b5eae5655014705 /src/handler/staticfile.rs
parent38de7e379f90fd16f3037309fc37cf3d990f7850 (diff)
downloadhttpd-cb6f70f6908aaea46c5d6332d3deb9a4a83733aa.tar.gz
return empty body in staticfile handler on HEAD
Diffstat (limited to 'src/handler/staticfile.rs')
-rw-r--r--src/handler/staticfile.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/handler/staticfile.rs b/src/handler/staticfile.rs
index 969c4d7..f208528 100644
--- a/src/handler/staticfile.rs
+++ b/src/handler/staticfile.rs
@@ -39,7 +39,10 @@ impl Handle for StaticFile {
("content-length", format!("{}", metadata.len())),
("content-type", self.mime),
])
- .body(Body::File(file)))
+ .body(match request.method() {
+ Method::Get => Body::File(file),
+ Method::Head => Body::Empty,
+ }))
} else {
Ok(Response::builder()
.status(Status::NotFound)