(target: &str)
| 4309 | } |
| 4310 | |
| 4311 | fn parse_target(target: &str) -> Result<(String, u16)> { |
| 4312 | let (host, port_str) = target |
| 4313 | .split_once(':') |
| 4314 | .ok_or_else(|| miette::miette!("CONNECT target missing port: {target}"))?; |
| 4315 | let port: u16 = port_str |
| 4316 | .parse() |
| 4317 | .map_err(|_| miette::miette!("Invalid port in CONNECT target: {target}"))?; |
| 4318 | Ok((host.to_string(), port)) |
| 4319 | } |
| 4320 | |
| 4321 | async fn respond(client: &mut TcpStream, bytes: &[u8]) -> Result<()> { |
| 4322 | client.write_all(bytes).await.into_diagnostic()?; |
no test coverage detected