#41512 [Opn->Csd]: ssl: socket_set_blocking not working
| From: | iliaa@php.net | Date: | Sun, 27 May 2007 17:06:04 +0000 |
| Subject: | #41512 [Opn->Csd]: ssl: socket_set_blocking not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113071@lists.php.net to get a copy of this message | ||
ID: 41512
Updated by: iliaa@php.net
Reported By: darkbytes at linuxwaves dot com
-Status: Open
+Status: Closed
Bug Type: Streams related
Operating System: Linux
PHP Version: 5.2.2
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2007-05-27 12:55:50] darkbytes at linuxwaves dot com
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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41512&edit=1