diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2025-03-07 10:00:48 +0000 |
---|---|---|
committer | Sven-Hendrik Haase <svenstaro@gmail.com> | 2025-03-07 11:14:03 +0000 |
commit | 11ea8a19d1481b0660e5a2765da6e67d3e8aa72c (patch) | |
tree | 341cb7ac4bd5915deb8fe58947b3cc352687556d /src/auth.rs | |
parent | Reformat style.scss (diff) | |
download | miniserve-11ea8a19d1481b0660e5a2765da6e67d3e8aa72c.tar.gz miniserve-11ea8a19d1481b0660e5a2765da6e67d3e8aa72c.zip |
Add asynchronous directory size counting
This is enabled by default and without an option to toggle it off as it's asynchronous and shouldn't
block the server thread.
Diffstat (limited to '')
-rw-r--r-- | src/auth.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/auth.rs b/src/auth.rs index fa28c4a..3bd9313 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1,4 +1,4 @@ -use actix_web::{HttpMessage, dev::ServiceRequest}; +use actix_web::{HttpMessage, dev::ServiceRequest, web}; use actix_web_httpauth::extractors::basic::BasicAuth; use sha2::{Digest, Sha256, Sha512}; @@ -77,7 +77,10 @@ pub async fn handle_auth( req: ServiceRequest, cred: BasicAuth, ) -> actix_web::Result<ServiceRequest, (actix_web::Error, ServiceRequest)> { - let required_auth = &req.app_data::<crate::MiniserveConfig>().unwrap().auth; + let required_auth = &req + .app_data::<web::Data<crate::MiniserveConfig>>() + .unwrap() + .auth; req.extensions_mut().insert(CurrentUser { name: cred.user_id().to_string(), |