php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1779 fgets() get nothing after HTTP header
Submitted: 1999-07-21 00:25 UTC Modified: 1999-10-04 17:27 UTC
From: silen at magicw3 dot com dot cn Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: Red Hat 5.1
Private report: No CVE-ID: None
 [1999-07-21 00:25 UTC] silen at magicw3 dot com dot cn
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-21 04:43 UTC] sas at cvs dot php dot net
Try the current PHP3 CVS: http://cvs.php.net
 [1999-10-04 17:27 UTC] sas at cvs dot php dot net
Please try PHP 3.0.12.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 20:00:02 2026 UTC