Skip to content

Commit

Permalink
Remind a user of the --http2 option
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1Yo committed Jul 12, 2021
1 parent 4123332 commit 6fe4a8a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
use colored::*;
use reqwest::Client;
use std::{
error::Error,
time::Duration,
collections::{BTreeMap, HashMap},
io::{self, Write},
Expand Down Expand Up @@ -190,6 +191,13 @@ pub async fn request(
Ok(val) => val,
Err(err) => {
writeln!(io::stderr(), "[!] {} {:?}", url, err).ok();
match err.source() {
Some(val) => if val.to_string() == "invalid HTTP version parsed" && !config.http2 {
writeln!(io::stdout(), "[!] {}", "Try to use --http2 option".bright_red()).ok();
std::process::exit(1);
},
None => ()
};
writeln!(io::stderr(), "[~] error at the {} observed. Wait 50 sec and repeat.", config.url).ok();
std::thread::sleep(Duration::from_secs(50));
match create_request(url, body.clone(), config, client).send().await {
Expand Down

0 comments on commit 6fe4a8a

Please sign in to comment.