@@ -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