Skip to content

Commit d10e822

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents ad31ffa + 2051ff3 commit d10e822

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

.idea/workspace.xml

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ derive_more = { version = "2.0.1", features = ["full"] }
1717
clap = { version = "4.5.28", features = ["derive"] }
1818
clap-verbosity-flag = { version = "3.0.2", features = ["tracing"] }
1919
rcgen = "0.13.2"
20+
dav-server = { git = "https://github.com/messense/dav-server-rs.git" }
2021

2122
[dev-dependencies]
2223
rusty-hook = "^0.11.2"

src/server/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ struct GitServer {
2525
}
2626

2727
/// Main entry point: chooses between TLS mode and plain HTTP.
28-
pub async fn launch(mut config: crate::config::Config) {
28+
#[allow(unused_variables)]
29+
// allow unused variables because we currently only need the config if the https feature
30+
// is enabled
31+
pub async fn launch(config: crate::config::Config) {
2932
// For TLS mode, config.port is the HTTPS port (e.g. 443)
3033
let https_addr = SocketAddr::from(([0, 0, 0, 0], 443));
3134
// Use port 80 for HTTP redirection.
@@ -52,8 +55,13 @@ pub async fn launch(mut config: crate::config::Config) {
5255
let redirect_router = redirect_router.into_make_service();
5356

5457
let https_server = run_https(https_addr, https_router.into_make_service());
55-
let http_redirect_server = run_http_redirect(http_addr, redirect_router);
56-
tokio::join!(https_server, http_redirect_server);
58+
match config.http_redirect {
59+
true => {
60+
let http_redirect_server = run_http_redirect(http_addr, redirect_router);
61+
tokio::join!(https_server, http_redirect_server);
62+
}
63+
false => tokio::task::block_in_place(move || https_server).await,
64+
}
5765
}
5866
} else {
5967
// Run only a plain HTTP server.

0 commit comments

Comments
 (0)