From 16e86dacf5bfae3d66eb8b63c16b22d1eefee3b6 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Tue, 3 Feb 2004 00:36:18 +0000 Subject: [PATCH] cpu theft and lockups found --- includes/GlobalFunctions.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 33e3a0efd2..b901bc4119 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -65,7 +65,7 @@ function wfLocalUrl( $a, $q = "" ) } else if ( "" == $q ) { $a = str_replace( "$1", $a, $wgArticlePath ); } else { - $a = "{$wgScript}?title={$a}&{$q}"; + $a = "/{$a}&{$q}"; } return $a; } @@ -773,10 +773,7 @@ function wfPurgeSquidServers ($urlArr) { } else { @fputs($socket,"PURGE " . $urlArr[0] . " HTTP/1.0\r\n". "Connection: Keep-Alive\r\n\r\n"); - $res = ''; - while (strlen($res) < 230 ) { - $res .= @fread($socket,512); - } + $res = @fread($socket,512); /* Squid only returns http headers with 200 or 404 status, if there's more returned something's wrong */ if (strlen($res) > 250) { @@ -803,8 +800,10 @@ function wfPurgeSquidServers ($urlArr) { for ($s=0;$s < $totalsockets;$s++) { if($r != 0) { $res = ''; - while (strlen($res) < 230 ) { + $esc = 0; + while (strlen($res) < 230 && $esc < 4 ) { $res .= @fread($sockets[$s],512); + $esc++; } } $urindex = $r + $urlspersocket * ($s - $sockspersq * floor($s / $sockspersq)); -- 2.20.1