From a7f81cf12e62857431a66a3c80f1c2746d95fb11 Mon Sep 17 00:00:00 2001 From: capric98 <42015599+capric98@users.noreply.github.com> Date: Thu, 7 Apr 2022 01:31:23 +0800 Subject: [PATCH] change level of reject reason to warning --- searx/plugins/limiter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/searx/plugins/limiter.py b/searx/plugins/limiter.py index 59ff7e79a..733647ba5 100644 --- a/searx/plugins/limiter.py +++ b/searx/plugins/limiter.py @@ -71,7 +71,7 @@ def is_accepted_request(inc_get_counter) -> bool: if request.path == '/image_proxy': if re_bot.match(user_agent): - logger.info(f"reject [{client_ip}]: client may be a bot described by UA=\"{user_agent}\"") + logger.warning(f"reject [{client_ip}]: client may be a bot described by UA=\"{user_agent}\"") return False return True @@ -80,15 +80,15 @@ def is_accepted_request(inc_get_counter) -> bool: c_10min = inc_get_counter(interval=600, keys=[b'IP limit, 10 minutes', client_ip]) if c_burst > c_burst_limit or c_10min > c_10min_limit: - logger.info(f"reject [{client_ip}]: c_burst({c_burst})>{c_burst_limit} or c_10min({c_10min})>{c_10min_limit}") + logger.warning(f"reject [{client_ip}]: c_burst({c_burst})>{c_burst_limit} or c_10min({c_10min})>{c_10min_limit}") return False if re_bot.match(user_agent): - logger.info(f"reject [{client_ip}]: client may be a bot described by UA=\"{user_agent}\"") + logger.warning(f"reject [{client_ip}]: client may be a bot described by UA=\"{user_agent}\"") return False if request.headers.get('Accept-Language', '').strip(): - logger.info(f"reject [{client_ip}]: empty Accept-Language") + logger.warning(f"reject [{client_ip}]: empty Accept-Language") return False # If SearXNG is behind Cloudflare, all requests will get 429 because @@ -102,7 +102,7 @@ def is_accepted_request(inc_get_counter) -> bool: # return False if 'text/html' not in request.accept_mimetypes: - logger.info(f"reject [{client_ip}]: non-html request to /search") + logger.warning(f"reject [{client_ip}]: non-html request to /search") return False # IDK but maybe api limit should based on path not format?