mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-10 14:04:14 +08:00
HTTP: Scan ban should only be triggered by HTTP parse errors
This commit is contained in:
parent
062863eb4c
commit
0529645790
1 changed files with 28 additions and 25 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue