Adjusted to use default “lib” version of “ckratelimit”

This commit is contained in:
pezcurrel 2024-08-27 21:25:19 +02:00
parent f94d03ffdf
commit 04ed9840b4

View file

@ -157,9 +157,9 @@ if ($errors=='' && $_GET['purl']!='') {
//while (true) { //while (true) {
$res=@file_get_contents('https://'.$url,false,stream_context_create($context)); $res=@file_get_contents('https://'.$url,false,stream_context_create($context));
if (isset($http_response_header)) if (isset($http_response_header))
$rl=ckratelimit($http_response_header,'echofun',true,false); $rl=ckratelimit($http_response_header);
//echo preprint($rl); //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 "<div class=\"warning\">Warning: could not write to rate limit state file.</div>\n"; echo "<div class=\"warning\">Warning: could not write to rate limit state file.</div>\n";
/*if ($rl['remaining']==0) /*if ($rl['remaining']==0)
break; break;
@ -198,8 +198,4 @@ function gethttpcode($headers) {
return preg_replace('#^[^ ]+ (\d+).*$#','$1',$headers[0]); return preg_replace('#^[^ ]+ (\d+).*$#','$1',$headers[0]);
} }
function echofun($msg) {
echo $msg;
}
?> ?>