Bug #74159 [NEW]: writing a large buffer to non-blocking encrypted streams fails
| From: | daverandom@php.net | Date: | Fri, 24 Feb 2017 00:37:33 +0000 |
| Subject: | Bug #74159 [NEW]: writing a large buffer to non-blocking encrypted streams fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207531@lists.php.net to get a copy of this message | ||
From: daverandom
Operating system: any
PHP version: Irrelevant
Package: OpenSSL related
Bug Type: Bug
Bug description:writing a large buffer to non-blocking encrypted streams fails
Description:
------------
Attempting to write a large buffer to a non-blocking encrypted stream
will fail, as SSL_write() expects to be passed the *exact* same buffer
(same ptr addr) for successive calls.
Test script:
---------------
<?php
$fp = stream_socket_client("tcp://lxr.room11.org:443");
stream_set_blocking($fp, false);
while (!stream_socket_enable_crypto($fp, true,
STREAM_CRYPTO_METHOD_ANY_CLIENT));
var_dump(fwrite($fp, "POST / HTTP/1.1\r\nHost:
lxr.room11.org\r\nContent-Type: text/plain\r\nContent-Length:
131072\r\n\r\n"));
$data = str_repeat("a", 65536);
var_dump(fwrite($fp, $data));
var_dump(fwrite($fp, $data));
var_dump(fwrite($fp, $data));
Expected result:
----------------
No errors
Actual result:
--------------
error:1409F07F:SSL routines:ssl3_write_pending:bad write retry
--
Edit bug report at https://bugs.php.net/bug.php?id=74159&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74159&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74159&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74159&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74159&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74159&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74159&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74159&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74159&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74159&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74159&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74159&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74159&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74159&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74159&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74159&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74159&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74159&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74159&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74159&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74159&r=mysqlcfg