|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-07 18:41 UTC] tony2001@php.net
[2007-03-07 20:00 UTC] andreas dot rieber at 2e-systems dot com
[2007-03-07 21:59 UTC] tony2001@php.net
[2007-03-08 13:32 UTC] andreas dot rieber at 2e-systems dot com
[2007-03-09 10:30 UTC] tony2001@php.net
[2007-03-11 14:51 UTC] andreas dot rieber at 2e-systems dot com
[2007-03-12 05:24 UTC] judas dot iscariote at gmail dot com
[2007-03-12 09:34 UTC] tony2001@php.net
[2007-03-12 12:59 UTC] andreas dot rieber at 2e-systems dot com
[2007-03-12 13:15 UTC] tony2001@php.net
[2007-03-12 14:32 UTC] andreas dot rieber at 2e-systems dot com
[2007-03-12 15:16 UTC] tony2001@php.net
[2007-03-12 18:12 UTC] judas dot iscariote at gmail dot com
[2007-03-14 19:22 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 02:00:01 2025 UTC |
Description: ------------ The timeout parameter of fsockopen overwrites the general read/write timeout. Without the timeout parameter in fsockopen or if you use stream_set_timeout after fsockopen it works. I created scipt a.php which opens b.php. the connection has a timeout of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and stream_get_meta_data shows that it timed out. It works with php 5.2.0. Reproduce code: --------------- code a.php <?php $fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5); if( !$fp) die( "$errno: $errstr"); fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n"); // read result $data = ''; while( !feof( $fp)) { $line = fgets( $fp, 8192); if( trim( $line) == '') break; $data .= $line; } fclose( $fp); // check header if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) { echo "Header OK"; } else { echo "Header failed"; } ?> code b.php <?php sleep( 7); ?> Expected result: ---------------- Header OK Actual result: -------------- Header failed