diff options
Diffstat (limited to 'ext/openssl/tests/bug74159.phpt')
-rw-r--r-- | ext/openssl/tests/bug74159.phpt | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/ext/openssl/tests/bug74159.phpt b/ext/openssl/tests/bug74159.phpt index 6a46fa5082..291bf38346 100644 --- a/ext/openssl/tests/bug74159.phpt +++ b/ext/openssl/tests/bug74159.phpt @@ -7,6 +7,9 @@ if (!function_exists("proc_open")) die("skip no proc_open"); ?> --FILE-- <?php +$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug74159.pem.tmp'; +$cacertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug74159-ca.pem.tmp'; + // the server code is doing many readings in a short interval which is // not really reliable on more powerful machine but cover different // scenarios which might be useful. More reliable test is bug72333.phpt @@ -14,7 +17,7 @@ $serverCode = <<<'CODE' $serverUri = "ssl://127.0.0.1:10012"; $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; $serverCtx = stream_context_create(['ssl' => [ - 'local_cert' => __DIR__ . '/bug54992.pem', + 'local_cert' => '%s', 'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, ]]); @@ -39,7 +42,9 @@ $serverCode = <<<'CODE' fclose($client); CODE; +$serverCode = sprintf($serverCode, $certFile); +$peerName = 'bug74159'; $clientCode = <<<'CODE' function streamRead($stream) : int { return strlen(fread($stream, 8192)); @@ -71,8 +76,8 @@ $clientCode = <<<'CODE' $clientFlags = STREAM_CLIENT_CONNECT; $clientCtx = stream_context_create(['ssl' => [ 'verify_peer' => true, - 'cafile' => __DIR__ . '/bug54992-ca.pem', - 'peer_name' => 'bug54992.local', + 'cafile' => '%s', + 'peer_name' => '%s', ]]); phpt_wait(); @@ -91,7 +96,7 @@ $clientCode = <<<'CODE' $data = substr($data, $written); waitForWrite($fp); } - printf("Written %d bytes\n", $total); + printf("Written %%d bytes\n", $total); while(waitForRead($fp)) { streamRead($fp); @@ -102,10 +107,21 @@ $clientCode = <<<'CODE' exit("DONE\n"); CODE; +$clientCode = sprintf($clientCode, $cacertFile, $peerName); + +include 'CertificateGenerator.inc'; +$certificateGenerator = new CertificateGenerator(); +$certificateGenerator->saveCaCert($cacertFile); +$certificateGenerator->saveNewCertAsFileWithKey($peerName, $certFile); include 'ServerClientTestCase.inc'; ServerClientTestCase::getInstance()->run($clientCode, $serverCode); ?> ---EXPECTF-- +--CLEAN-- +<?php +@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug74159.pem.tmp'); +@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug74159-ca.pem.tmp'); +?> +--EXPECT-- Written 1048575 bytes DONE |