Bug #67965 [Opn->Csd]: Regression: stream_select blocks when using tls
| From: | rdlowrey@php.net | Date: | Tue, 09 Sep 2014 16:37:48 +0000 |
| Subject: | Bug #67965 [Opn->Csd]: Regression: stream_select blocks when using tls | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187475@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67965&edit=1
ID: 67965
Updated by: rdlowrey@php.net
Reported by: arjen at react dot com
Summary: Regression: stream_select blocks when using tls
-Status: Open
+Status: Closed
Type: Bug
Package: Streams related
Operating System: Linux
PHP Version: 5.5Git-2014-09-05 (Git)
-Assigned To:
+Assigned To: rdlowrey
Block user comment: N
Private report: N
New Comment:
This should be fixed in commit f86b2193a:
https://github.com/php/php-src/commit/f86b2193a483f56b0bd056570a0cdb57ebe66e2f
Thanks for the report. If your issues persist (hopefully the won't) please update this issue :)
Previous Comments:
------------------------------------------------------------------------
[2014-09-05 10:28:52] arjen at react dot com
Description:
------------
stream_select blocks if there is still data in the read buffer which you haven't read yet..
Testscripts reads 8096 bytes (default chunksize) but there's already more to read. We expect
stream_select to return $read again but it won't.
This works fine in 5.5.16 and previous versions.
Broken by https://github.com/php/php-src/commit/32be79dcfa1bc5af8682d9f512da68c5b3e2cbf3
https://bugs.php.net/bug.php?id=65137
Btw, tested using PHP5.5.16RC1 from http://downloads.php.net/jpauli/php-5.5.17RC1.tar.gz
Test script:
---------------
<?php
$host = 'tcp://php.net:443';
$chunkSize = 8192;
$fp = stream_socket_client($host, $errNumber, $errString, 5, STREAM_CLIENT_CONNECT);
stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
$data = "GET / HTTP/1.1\r\nConnection: close\r\nHost: php.net\r\n\r\n";
fwrite($fp, $data);
while (!feof($fp))
{
$read = array($fp);
$except = $write = null;
$changed = stream_select($read, $write, $except, 5, 0);
if (!empty($read))
{
$read = fread($fp, $chunkSize);
echo 'read ' . strlen($read) . PHP_EOL;
}
}
Expected result:
----------------
read 8192
read 8192
read 8192
read 5961
Actual result:
--------------
read 8192
read 8192
and script hangs..
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67965&edit=1