diff --git a/.gitignore b/.gitignore index ea8c4bf..7a413ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +TODO +/staging \ No newline at end of file diff --git a/src/common/console.rs b/src/common/console.rs index 42bbfa0..f2c5580 100644 --- a/src/common/console.rs +++ b/src/common/console.rs @@ -33,11 +33,11 @@ pub fn parsehit(sc: u16, url: String, title: String) -> String { format!( "{} {} {} {}{}{}", fmtcode(sc), - "|".black().bold(), + "|".bright_black().bold(), url.white().underline(), - "[".black().bold(), + "[".bright_black().bold(), parsetitle(title).bright_cyan().bold(), - "]".black().bold() + "]".bright_black().bold() ) } @@ -46,6 +46,6 @@ pub fn banner() { "{}{} {}", "speed".bright_cyan().bold(), "boat".bright_magenta().bold(), - VERSION.black() + VERSION.bright_black() ); } diff --git a/src/common/net.rs b/src/common/net.rs index d8ce68d..a249411 100644 --- a/src/common/net.rs +++ b/src/common/net.rs @@ -19,13 +19,24 @@ pub fn mkclient(redir: bool) -> Result { .build() } +async fn sendreq(c: &Client, use_https: bool, url: &str) -> Result { + let dest: String = if use_https { format!("https://{url}/") } else { format!("http://{url}/") }; + c.get(dest).send().await +} + pub async fn query( c: Client, url: &str, codes: Vec, exclude: bool, ) -> Result<(), reqwest::Error> { - let response = c.get(format!("http://{url}/")).send().await?; + let response: reqwest::Response; + if let Ok(res) = sendreq(&c, true, url).await { + response = res; + } else { + response = sendreq(&c, false, url).await?; + } + let statcode = response.status().as_u16(); if codes.len() > 0 {