~julienxx/asuka

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Safely unwrap URL host

Details
Message ID
<20210228130917.25724-1-mark@markdain.net>
DKIM signature
missing
Download raw message
Patch: +1 -1
This commit fixes a crash that happens when the user attempts to
navigate to `gemini://'

With this fix, Asuka now displays an error message:

    Could not connect to :1965
    failed to lookup address information: Name or service not known
---
 src/content.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/content.rs b/src/content.rs
index 184d9e4..02fdc41 100644
--- a/src/content.rs
+++ b/src/content.rs
@@ -6,7 +6,7 @@ use std::net::{TcpStream, ToSocketAddrs};
use std::time::Duration;

pub fn get_data(url: &url::Url) -> Result<(Vec<u8>, Vec<u8>), String> {
    let host = url.host_str().unwrap();
    let host = url.host_str().unwrap_or("");
    let urlf = format!("{}:1965", host);

    let mut builder = TlsConnector::builder();
--
2.30.1
Reply to thread Export thread (mbox)