refine shellchat net tls test for tls 1.3

https://docs.rs/rustls/latest/rustls/manual/_03_howto/index.html#unexpected-eof
This commit is contained in:
nworbnhoj 2024-02-28 13:55:49 +10:00
parent 332c2975ba
commit 17c1fabc1e

View file

@ -98,11 +98,7 @@ pub fn shellchat<'a>(mut tokens: impl Iterator<Item = &'a str>) -> Result<Option
Ok(mut conn) => {
let mut tls = rustls::Stream::new(&mut conn, &mut sock);
log::info!("create http headers and write to server");
let msg = format!(
"GET / HTTP/1.1\r\nHost: {}\r\nConnection: close\r\nAccept-Encoding: identity\r\n\r\n",
target
);
match tls.write_all(msg.as_bytes()) {
match tls.write_all(b"GET / HTTP/1.1\r\n\r\n") {
Ok(()) => {
log::info!("tls accepted GET");
write!(ret, "{}", t!("tls.test_success_get", locales::LANG)).ok();