mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
chore: example.com returns HTTP/1.1
This commit is contained in:
@@ -131,7 +131,7 @@ async fn tcp_tunnel_example(
|
|||||||
|
|
||||||
let mut client = TcpStream::connect(local_addr).await?;
|
let mut client = TcpStream::connect(local_addr).await?;
|
||||||
|
|
||||||
const HTTP_REQUEST: &[u8] = b"GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\nConnection: close\r\n\r\n";
|
const HTTP_REQUEST: &[u8] = b"GET / HTTP/1.1\r\nHost: www.example.com\r\nAccept: */*\r\nConnection: close\r\n\r\n";
|
||||||
client.write_all(HTTP_REQUEST).await?;
|
client.write_all(HTTP_REQUEST).await?;
|
||||||
|
|
||||||
let mut reader = BufReader::new(client);
|
let mut reader = BufReader::new(client);
|
||||||
@@ -141,7 +141,7 @@ async fn tcp_tunnel_example(
|
|||||||
|
|
||||||
println!("{:?}", ByteStr::new(&buffer));
|
println!("{:?}", ByteStr::new(&buffer));
|
||||||
|
|
||||||
const HTTP_RESPONSE_STATUS: &[u8] = b"HTTP/1.0 200 OK\r\n";
|
const HTTP_RESPONSE_STATUS: &[u8] = b"HTTP/1.1 200 OK\r\n";
|
||||||
assert!(buffer.starts_with(HTTP_RESPONSE_STATUS));
|
assert!(buffer.starts_with(HTTP_RESPONSE_STATUS));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ async fn tcp_tunnel_tfo() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
client
|
client
|
||||||
.write_all(b"GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\nConnection: close\r\n\r\n")
|
.write_all(b"GET / HTTP/1.1\r\nHost: www.example.com\r\nAccept: */*\r\nConnection: close\r\n\r\n")
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@@ -97,6 +97,6 @@ async fn tcp_tunnel_tfo() {
|
|||||||
|
|
||||||
println!("{:?}", ByteStr::new(&buffer));
|
println!("{:?}", ByteStr::new(&buffer));
|
||||||
|
|
||||||
const HTTP_RESPONSE_STATUS: &[u8] = b"HTTP/1.0 200 OK\r\n";
|
const HTTP_RESPONSE_STATUS: &[u8] = b"HTTP/1.1 200 OK\r\n";
|
||||||
assert!(buffer.starts_with(HTTP_RESPONSE_STATUS));
|
assert!(buffer.starts_with(HTTP_RESPONSE_STATUS));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user