From d05ab23404df5a7200245e39c08da8dc17fa2bd2 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Mon, 16 Mar 2026 18:21:01 +0400 Subject: [PATCH] test: remove https tests --- src-tauri/tests/donut_proxy_integration.rs | 60 +--------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/src-tauri/tests/donut_proxy_integration.rs b/src-tauri/tests/donut_proxy_integration.rs index 0f52a07..968efee 100644 --- a/src-tauri/tests/donut_proxy_integration.rs +++ b/src-tauri/tests/donut_proxy_integration.rs @@ -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();