diff --git a/Cargo.lock b/Cargo.lock index f290aa086..e2d6949c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -258,7 +258,7 @@ dependencies = [ [[package]] name = "duf" -version = "0.2.0" +version = "0.2.1" dependencies = [ "async-walkdir", "async_zip", diff --git a/Cargo.toml b/Cargo.toml index 5739f506c..beb81b489 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duf" -version = "0.2.0" +version = "0.2.1" edition = "2021" authors = ["sigoden "] description = "Duf is a simple file server." diff --git a/README.md b/README.md index c90559bf0..79ebe8f91 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,6 @@ duf --static Finally, run this command to see a list of all available option - - ### Curl Download a file diff --git a/src/main.rs b/src/main.rs index 208eb169a..7472ec649 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,14 +25,18 @@ async fn main() { async fn run() -> BoxResult<()> { let args = Args::parse(matches())?; - let level = if args.log { - LevelFilter::Info + if std::env::var("RUST_LOG").is_ok() { + simple_logger::init()?; } else { - LevelFilter::Error - }; - simple_logger::SimpleLogger::default() - .with_level(level) - .init()?; + let level = if args.log { + LevelFilter::Info + } else { + LevelFilter::Error + }; + simple_logger::SimpleLogger::default() + .with_level(level) + .init()?; + } serve(args).await } diff --git a/src/server.rs b/src/server.rs index f4967b4cf..534b3c92a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -187,7 +187,7 @@ impl InnerService { } async fn handle_send_dir_zip(&self, path: &Path) -> BoxResult { - let (mut writer, reader) = tokio::io::duplex(65536); + let (mut writer, reader) = tokio::io::duplex(1024 * 1024 * 20); dir_zip(&mut writer, path).await?; let stream = ReaderStream::new(reader); let body = Body::wrap_stream(stream);