diff options
| author | John Turner <jturner.usa@gmail.com> | 2026-03-05 01:46:40 -0500 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2026-03-05 01:46:40 -0500 |
| commit | cb6f70f6908aaea46c5d6332d3deb9a4a83733aa (patch) | |
| tree | ddd0ac4b489cd2bdcfc25f434b5eae5655014705 /src/handler/staticfile.rs | |
| parent | 38de7e379f90fd16f3037309fc37cf3d990f7850 (diff) | |
| download | httpd-cb6f70f6908aaea46c5d6332d3deb9a4a83733aa.tar.gz | |
return empty body in staticfile handler on HEAD
Diffstat (limited to 'src/handler/staticfile.rs')
| -rw-r--r-- | src/handler/staticfile.rs | 5 |
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) |
