|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-27 17:06 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
Description: ------------ socket_set_blocking() is not working on a ssl-connection. the reproduce code shows a connection without and with ssl, and loops for each to 10 when socket_set_blocking is working. plain sourcepacket from php.net, no patches: ./configure --enable-sockets --with-openssl Reproduce code: --------------- <?php echo "connecting without ssl\n"; $sock = fsockopen("euserv.de", 80,$errno, $errstr, 30); if($sock) echo "connected;\n"; socket_set_blocking($sock, 0); $count=0; while (!feof($sock)) { echo "loop: ".$count."\n"; fgets($sock, 4096); if($count==10) break; $count++; } fclose($sock); unset($sock); if($count==10) echo "stream_set_blocking(\$sock, 0); seems to work without ssl!\n"; else echo "it is not working :(\n"; echo "connecting with ssl\n"; $sock = fsockopen("ssl://euserv.de", 443,$errno, $errstr, 30); stream_set_blocking($sock, 0); $count=0; while (!feof($sock)) { echo "loop: ".$count."\n"; fgets($sock, 4096); if($count==10) break; $count++; } fclose($sock); unset($sock); if($count==10) echo "stream_set_blocking(\$sock, 0); seems to work with ssl!\n"; else echo "it is not working :(\n"; ?> Expected result: ---------------- it should loop from 0 to 10 two times - with and without ssl. Actual result: -------------- for me and a friend it outputs: [root@raw www]# php block.php connecting without ssl connected; loop: 0 loop: 1 ... loop: 10 stream_set_blocking($sock, 0); seems to work without ssl! connecting with ssl loop: 0 ---- here it hangs - socket seems to wait for input.