summaryrefslogtreecommitdiff
path: root/src/files.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-11-14 11:54:01 +0100
committermetamuffin <metamuffin@disroot.org>2023-11-14 11:54:01 +0100
commit3b1afad1d1a697e82c003e146ef2b7d5742e5210 (patch)
tree3a9e02470b4f78c4c34c0573c788da301a9e544e /src/files.rs
parent4a7bd84594fb8d159a0a2af02818f283eab3e716 (diff)
downloadgnix-3b1afad1d1a697e82c003e146ef2b7d5742e5210.tar
gnix-3b1afad1d1a697e82c003e146ef2b7d5742e5210.tar.bz2
gnix-3b1afad1d1a697e82c003e146ef2b7d5742e5210.tar.zst
refactor architecture and start on http basic auth
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/files.rs b/src/files.rs
index 68a3807..cf53942 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -21,7 +21,7 @@ use tokio::{
use tokio_util::io::poll_read_buf;
pub async fn serve_files(
- req: Request<Incoming>,
+ req: &Request<Incoming>,
config: &FileserverConfig,
) -> Result<hyper::Response<BoxBody<Bytes, ServiceError>>, ServiceError> {
let rpath = req.uri().path();
@@ -56,6 +56,7 @@ pub async fn serve_files(
if !config.index {
return Err(ServiceError::NotFound);
}
+ debug!("sending index for {path:?}");
if !rpath.ends_with("/") {
let mut r = Response::new(String::new());
@@ -78,6 +79,7 @@ pub async fn serve_files(
let range = req.headers().typed_get::<headers::Range>();
let range = bytes_range(range, metadata.len())?;
+ debug!("sending file {path:?}");
let file = File::open(path.clone()).await?;
let mut r = Response::new(BoxBody::new(StreamBody::new(