try to fix test

This commit is contained in:
fakeshadow 2021-11-01 17:31:05 +08:00
parent 17d7c76843
commit 7f5212c990
1 changed files with 6 additions and 8 deletions

View File

@ -795,17 +795,15 @@ async fn client_unread_response() {
let lst = std::net::TcpListener::bind(addr).unwrap(); let lst = std::net::TcpListener::bind(addr).unwrap();
std::thread::spawn(move || { std::thread::spawn(move || {
for stream in lst.incoming() { let (mut stream, _) = lst.accept().unwrap();
let mut stream = stream.unwrap(); let mut b = [0; 1000];
let mut b = [0; 1000]; let _ = stream.read(&mut b).unwrap();
let _ = stream.read(&mut b).unwrap(); let _ = stream.write_all(
let _ = stream.write_all( b"HTTP/1.1 200 OK\r\n\
b"HTTP/1.1 200 OK\r\n\
connection: close\r\n\ connection: close\r\n\
\r\n\ \r\n\
welcome!", welcome!",
); );
}
}); });
// client request // client request