handle unknown header on server

This commit is contained in:
MeexReay 2025-07-28 22:06:22 +03:00
parent d5511e1938
commit 270ef5cf84

View file

@ -102,20 +102,24 @@ async fn handle_request(
stack = match (stack, n) { stack = match (stack, n) {
(0, b'\r') => 1, (0, b'\r') => 1,
(1, b'\n') => { (1, b'\n') => {
if key == b"Host" { if !status {
remote = String::from_utf8(value.clone())?; if key == b"Host" {
} else if key == b"Authentication" { remote = String::from_utf8(value.clone())?;
let passhash = String::from_utf8(value.clone())?; } else if key == b"Authentication" {
if !bcrypt::verify(password.clone(), &format!("{stable_id}{passhash}"))? { let passhash = String::from_utf8(value.clone())?;
return Err("bad passhash error!!! not nice env!!".into()); if !bcrypt::verify(password.clone(), &format!("{stable_id}{passhash}"))? {
return Err("bad passhash error!!! not nice env!!".into());
}
} else if key == b"UDP" {
udp = value == b"1";
} else {
return Err("unknown header provided!! malware connection".into());
} }
} else if key == b"UDP" {
udp = value == b"1";
}
is_key = true; is_key = true;
key.clear(); key.clear();
value.clear(); value.clear();
}
2 2
}, },
(2, b'\r') => 3, (2, b'\r') => 3,