From c7eacfb643b337b0c9cb19244259ebaf20f643d1 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Thu, 31 Oct 2024 20:24:29 +0100 Subject: [PATCH] =?UTF-8?q?Added=20=E2=80=9Cshowrem=E2=80=9D=20parameter?= =?UTF-8?q?=20to=20make=20it=20possible=20to=20monitor=20remaining=20hits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ckratelimit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ckratelimit.php b/lib/ckratelimit.php index ad9b21d..e8e3295 100644 --- a/lib/ckratelimit.php +++ b/lib/ckratelimit.php @@ -1,6 +1,6 @@ false,'error'=>'no «x-ratelimit-remaining» header']; if (preg_match('#^\d+$#',$aaheaders['x-ratelimit-remaining'])!==1) return ['ok'=>false,'error'=>'«x-ratelimit-remaining» header is not an integer']; $remaining=$aaheaders['x-ratelimit-remaining']+0; + if ($showrem) echo "ckratelimit: remaining: {$remaining}\n"; $date=@strtotime($aaheaders['date']); if (!is_int($date)) return ['ok'=>false,'error'=>'«date» header could not be converted to a unix timestamp']; $reset=@strtotime($aaheaders['x-ratelimit-reset']);