while((!@feof($mysock))||(($chunked)&&($buffer_unprocessed!=''))){// @'d because socket might have died. If so fread will will return false and hence we'll break
// We don't know our stream is broken, so let's consider us done, just that the connection was not detected on our as properly closed with EOF...
break;
}
}
$line=@fread($mysock,32000);
if($line===false){
if((!$chunked)||($buffer_unprocessed=='')){
// Implicit EOF, so terminate
if(($chunked)&&($buffer_unprocessed!='')){
$_frh=array();// Will trigger a detected timeout on next loop cycle. Note stream_select also can empty $_frh, and we are simulating the same thing here but without any overhead on waiting for stream_select