Procházet zdrojové kódy

client: ensure web server is valid URI

Justin Tracey před 7 měsíci
rodič
revize
c98a336f68
1 změnil soubory, kde provedl 15 přidání a 11 odebrání
  1. 15 11
      src/bin/mgen-client.rs

+ 15 - 11
src/bin/mgen-client.rs

@@ -141,17 +141,21 @@ async fn reader(
                 };
 
                 if msg.body.has_attachment() {
-                    let url: hyper::Uri =
-                        format!("{}/?size={}&user={}", target, msg.body.total_size(), user)
-                            .parse()
-                            .unwrap_or_else(|_| {
-                                panic!(
-                                    "Invalid URI: {}/?size={}&user={}",
-                                    target,
-                                    msg.body.total_size(),
-                                    user
-                                )
-                            });
+                    let url: hyper::Uri = format!(
+                        "https://{}/?size={}&user={}",
+                        target,
+                        msg.body.total_size(),
+                        user
+                    )
+                    .parse()
+                    .unwrap_or_else(|_| {
+                        panic!(
+                            "Invalid URI: {}/?size={}&user={}",
+                            target,
+                            msg.body.total_size(),
+                            user
+                        )
+                    });
                     let client = client.clone();
                     tokio::spawn(async move {
                         let mut res = client.get(url.clone()).await;