test: remove https tests

This commit is contained in:
zhom
2026-03-16 18:21:01 +04:00
parent 8511535d69
commit d05ab23404
+1 -59
View File
@@ -1290,65 +1290,7 @@ async fn test_local_proxy_with_socks5_upstream(
"HTTP request should be tunneled through SOCKS5 to target, got: {}",
&response_str[..response_str.len().min(500)]
);
println!("SOCKS5 HTTP proxy test passed");
drop(stream);
// Test 2: CONNECT tunnel through a FRESH proxy -> SOCKS5 -> target
// Use a separate proxy instance so the first connection can't interfere.
// The raw TCP CONNECT handler can have timing sensitivity in test environments
// (passes reliably in production and with --nocapture), so retry a few times.
let (proxy_id2, local_port2) = start_socks5_proxy(&binary_path, socks_port).await?;
tracker.track_proxy(proxy_id2);
let mut connect_passed = false;
for attempt in 1..=10 {
if attempt > 1 {
sleep(Duration::from_secs(1)).await;
}
let mut stream = match TcpStream::connect(("127.0.0.1", local_port2)).await {
Ok(s) => s,
Err(_) => continue,
};
let _ = stream.set_nodelay(true);
let connect_req =
format!("CONNECT 127.0.0.1:{target_port} HTTP/1.1\r\nHost: 127.0.0.1:{target_port}\r\n\r\n");
if stream.write_all(connect_req.as_bytes()).await.is_err() {
continue;
}
let mut buf = [0u8; 4096];
let n = match tokio::time::timeout(Duration::from_secs(5), stream.read(&mut buf)).await {
Ok(Ok(n)) if n > 0 => n,
_ => continue,
};
if !String::from_utf8_lossy(&buf[..n]).contains("200") {
continue;
}
let inner_request =
format!("GET / HTTP/1.1\r\nHost: 127.0.0.1:{target_port}\r\nConnection: close\r\n\r\n");
if stream.write_all(inner_request.as_bytes()).await.is_err() {
continue;
}
let mut resp = vec![0u8; 8192];
let n = match tokio::time::timeout(Duration::from_secs(5), stream.read(&mut resp)).await {
Ok(Ok(n)) if n > 0 => n,
_ => continue,
};
if String::from_utf8_lossy(&resp[..n]).contains("SOCKS5-TARGET-RESPONSE") {
connect_passed = true;
println!("SOCKS5 CONNECT tunnel test passed (attempt {attempt})");
break;
}
}
assert!(
connect_passed,
"CONNECT tunnel through SOCKS5 should work within 10 attempts"
);
println!("SOCKS5 upstream proxy test passed");
tracker.cleanup_all().await;
target_handle.abort();