#18731 [NEW]: fputs( $sock, $str0 ). $str0 needs to have '\n' to work properly.

From: Date: Sun, 04 Aug 2002 11:46:26 +0000
Subject: #18731 [NEW]: fputs( $sock, $str0 ). $str0 needs to have '\n' to work properly.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15966@lists.php.net to get a copy of this message
From: tondur@ozemail.com.au Operating system: Win2k/Winnt v4sp6 PHP version: 4.2.2 PHP Bug Type: Sockets related Bug description: fputs( $sock, $str0 ). $str0 needs to have '\n' to work properly. <?php $fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> This will work but if fputs( ) is this fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com"); ie no "\r\n\r\n", then fgets( ) will block and the code will timeout. On the server side, the "GET / ..." is read, but will block on the send( ). -- Edit bug report at http://bugs.php.net/?id=18731&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18731&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18731&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18731&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18731&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18731&r=support Expected behavior: http://bugs.php.net/fix.php?id=18731&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18731&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18731&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18731&r=globals

« previous php.bugs (#15966) next »