Skip to content

Commit f024462

Browse files
committed
fix: fixed parse_target by stripping elements that caused problems
1 parent 5706061 commit f024462

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/session/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ impl Session {
108108

109109
// perform pre-emptive target validation
110110
for target in &targets {
111-
if let Err(e) = parse_target(target, 0) {
112-
return Err(e);
113-
}
111+
parse_target(target, 0)?;
114112
}
115113

116114
let runtime = Runtime::new(options.concurrency);

src/utils/target/single.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ pub(crate) fn parse_target(target: &str, default_port: u16) -> Result<(String, u
88
));
99
}
1010

11+
// remove <proto>:// if present
12+
let target = if target.contains("://") {
13+
target.split_once("://").unwrap().1
14+
} else {
15+
target
16+
};
17+
18+
// remove /<whatever> if present
19+
let target = if target.contains('/') {
20+
target.split_once('/').unwrap().0
21+
} else {
22+
target
23+
};
24+
1125
let num_colons = target.matches(':').count();
1226
let (address, port) = if num_colons <= 1 {
1327
// domain or ipv4

0 commit comments

Comments
 (0)