Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllers/helpers/pagination: Remove generic parameter from is_useragent_or_ip_blocked() fn #10191

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/controllers/helpers/pagination.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::config::Server;
use crate::controllers::util::RequestPartsExt;
use crate::middleware::app::RequestApp;
use crate::middleware::log_request::RequestLogExt;
use crate::middleware::real_ip::RealIp;
Expand Down Expand Up @@ -317,9 +316,9 @@ impl RawSeekPayload {
///
/// A request can be blocked if either the User Agent is on the User Agent block list or if the client
/// IP is on the CIDR block list.
fn is_useragent_or_ip_blocked<T: RequestPartsExt>(config: &Server, req: &T) -> bool {
let user_agent = req.headers().get_str_or_default(header::USER_AGENT);
let client_ip = req.extensions().get::<RealIp>();
fn is_useragent_or_ip_blocked(config: &Server, req: &Parts) -> bool {
let user_agent = req.headers.get_str_or_default(header::USER_AGENT);
let client_ip = req.extensions.get::<RealIp>();

// check if user agent is blocked
if config
Expand Down