Bug #1779: fgets() get nothing after HTTP header
| From: | silen at magicw3 dot com dot cn | Date: | Wed, 21 Jul 1999 04:25:15 +0000 |
| Subject: | Bug #1779: fgets() get nothing after HTTP header | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8834@lists.php.net to get a copy of this message | ||
From: silen@magicw3.com.cn
Operating system: Red Hat 5.1
PHP version: 3.0.11
PHP Bug Type: Misbehaving function
Bug description: fgets() get nothing after HTTP header
I've written a script to implement HTTP/1.0 connection to web servers. Like this:
$fp=fsockopen("localhost",80);
if($fp){
fputs($fp,"GET / HTTP/1.0\r\n\r\n");
$i=0;
while(!feof($fp)){
$i++;
$temp=fgets($fp,128);
//$temp=fgetc($fp);
echo "$i-----<br>$temp<br>-----<br>";
$response.=$temp;
}
}
After I upgrade to 3.0.11, I found this script fall into endless loop. I track execution of the
script and found that
fgets get nothing after the HTTP header of the response. If I change fgets() to fgetc(), there will
be no problem.
Please check out the problem. Thanks.
regards,
Zili Zhang