Bug #62960 [Com]: non block stream does not work with ssl

From: Date: Thu, 03 Apr 2014 10:58:02 +0000
Subject: Bug #62960 [Com]: non block stream does not work with ssl
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185063@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62960&edit=1 ID: 62960 Comment by: heruan at aldu dot net Reported by: jim dot javathunderbird at gmail dot com Summary: non block stream does not work with ssl Status: Open Type: Bug Package: Streams related Operating System: CentOS 64 bit PHP Version: 5.4.6 Block user comment: N Private report: N New Comment: Note that *writing* to the encrypted stream seems working, it's *reading* that won't work and it is reported on #65137. Previous Comments: ------------------------------------------------------------------------ [2014-04-03 10:24:24] heruan at aldu dot net No one has ever given a feedback to this bug. It still affects PHP 5.5.9, any chance to get this fixed in 5.6? ------------------------------------------------------------------------ [2012-08-28 19:07:12] jim dot javathunderbird at gmail dot com Description: ------------ When using stream_socket_server with non blocking stream, there seems to have no way to write buffer to client. When the stream is in blocking mode, things start working again. Test script: --------------- <?php $protocol = "ssl"; $ip = "127.0.0.1"; $port = 8000; $context = stream_context_create(); $certificate = __DIR__."/certificate_concat.pem"; stream_context_set_option($context, 'ssl', 'local_cert', $certificate); stream_context_set_option($context, 'ssl', 'verify_peer', false); $server = stream_socket_server("$protocol://$ip:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context); stream_set_blocking($server, 0); //when set to non blocking, ssl will not work, if set to blocking, things start working again while(true) { $client = stream_socket_accept($server); print "accepted " . stream_socket_get_name( $client, true) . "\n"; if( $client ) { fwrite($client, "hello"); } else { print "error.\n"; } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62960&edit=1

« previous php.bugs (#185063) next »