Skip to content

Commit

Permalink
controllers/helpers/pagination: Remove generic parameter from `is_use…
Browse files Browse the repository at this point in the history
…ragent_or_ip_blocked()` fn (#10191)
  • Loading branch information
Turbo87 authored Dec 12, 2024
1 parent 7792c0e commit d4831a6
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit d4831a6

Please sign in to comment.