From 04ed9840b42fef03e5044b99232333cab01f32c7 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Tue, 27 Aug 2024 21:25:19 +0200 Subject: [PATCH] =?UTF-8?q?Adjusted=20to=20use=20default=20=E2=80=9Clib?= =?UTF-8?q?=E2=80=9D=20version=20of=20=E2=80=9Cckratelimit=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 9cb40d3..28a5b20 100644 --- a/index.php +++ b/index.php @@ -157,9 +157,9 @@ if ($errors=='' && $_GET['purl']!='') { //while (true) { $res=@file_get_contents('https://'.$url,false,stream_context_create($context)); if (isset($http_response_header)) - $rl=ckratelimit($http_response_header,'echofun',true,false); + $rl=ckratelimit($http_response_header); //echo preprint($rl); - if (is_array($rl) && @file_put_contents(RLFP,$rl['remaining']."\n".($rl['secstoreset']+time())."\n")===false) + if (isset($rl['ok']) && $rl['ok'] && @file_put_contents(RLFP,$rl['remaining']."\n".($rl['sleep']+time())."\n")===false) echo "
Warning: could not write to rate limit state file.
\n"; /*if ($rl['remaining']==0) break; @@ -198,8 +198,4 @@ function gethttpcode($headers) { return preg_replace('#^[^ ]+ (\d+).*$#','$1',$headers[0]); } -function echofun($msg) { - echo $msg; -} - ?>