HTTP: Scan ban should only be triggered by HTTP parse errors

This commit is contained in:
mdecimus 2025-08-23 19:49:58 +02:00
parent 062863eb4c
commit 0529645790

View file

@ -813,6 +813,7 @@ async fn handle_session<T: SessionStream>(inner: Arc<Inner>, session: SessionDat
.with_upgrades() .with_upgrades()
.await .await
{ {
if http_err.is_parse() {
match inner match inner
.build_server() .build_server()
.is_scanner_fail2banned(session.remote_ip) .is_scanner_fail2banned(session.remote_ip)
@ -825,14 +826,9 @@ async fn handle_session<T: SessionStream>(inner: Arc<Inner>, session: SessionDat
RemoteIp = session.remote_ip, RemoteIp = session.remote_ip,
Reason = http_err.to_string(), Reason = http_err.to_string(),
); );
return;
} }
Ok(false) => { Ok(false) => {}
trc::event!(
Http(trc::HttpEvent::Error),
SpanId = session.session_id,
Reason = http_err.to_string(),
);
}
Err(err) => { Err(err) => {
trc::error!( trc::error!(
err.span_id(session.session_id) err.span_id(session.session_id)
@ -841,6 +837,13 @@ async fn handle_session<T: SessionStream>(inner: Arc<Inner>, session: SessionDat
} }
} }
} }
trc::event!(
Http(trc::HttpEvent::Error),
SpanId = session.session_id,
Reason = http_err.to_string(),
);
}
} }
impl SessionManager for HttpSessionManager { impl SessionManager for HttpSessionManager {