From 1b939b6dc03e67271cd2f628bd37aba67d640181 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Wed, 23 Oct 2024 23:10:11 +0200 Subject: [PATCH] =?UTF-8?q?Added=20=E2=80=9Cshowrem=E2=80=9D=20parameter,?= =?UTF-8?q?=20defaulting=20to=20false;=20shows=20remaining=20hits=20when?= =?UTF-8?q?=20true?= 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']);