com php-src: Revert "Fix bug #74159": ext/openssl/tests/bug74159.phpt ext/openssl/xp_ssl.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    511a4b0918bc6a70b706cc3ed90e03daa0852c02
Author:    Anatol Belski <[email protected]>         Thu, 2 Mar 2017 20:40:41 +0100
Parents:   46a418f450248d0d0d74ab348e9125f0ef42b8dc
Branches:  PHP-7.0.17

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=511a4b0918bc6a70b706cc3ed90e03daa0852c02

Log:
Revert "Fix bug #74159"

This reverts commit e9873d9853da2b6153776c2e5ed6858e87f0baa2.

Bugs:
https://bugs.php.net/74159

Changed paths:
  D  ext/openssl/tests/bug74159.phpt
  M  ext/openssl/xp_ssl.c


Diff:
diff --git a/ext/openssl/tests/bug74159.phpt b/ext/openssl/tests/bug74159.phpt
deleted file mode 100644
index 0299cf1..0000000
--- a/ext/openssl/tests/bug74159.phpt
+++ /dev/null
@@ -1,106 +0,0 @@
---TEST--
-Bug #74159: Writing a large buffer to non-blocking encrypted streams fails
---SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip openssl not loaded");
-if (!function_exists("proc_open")) die("skip no proc_open");
---FILE--
-<?php
-$serverCode = <<<'CODE'
-    $serverUri = "ssl://127.0.0.1:64321";
-    $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
-    $serverCtx = stream_context_create(['ssl' => [
-        'local_cert' => __DIR__ . '/bug54992.pem',
-        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
-    ]]);
-
-    $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
-    phpt_notify();
-
-    $client = stream_socket_accept($server, 1);
-
-    if (!$client) {
-        exit();
-    }
-
-    $data = '';
-    while (strlen($data) < 0xfffff) {
-        $buffer = fread($client, 8192);
-        if (empty($buffer)) {
-            exit();
-        }
-        $data .= $buffer;
-        usleep(100);
-    }
-    
-    fclose($client);
-CODE;
-
-$clientCode = <<<'CODE'
-    function streamRead($stream) : int {
-        return strlen(fread($stream, 8192));
-    }
-
-    function streamWrite($stream, $data) : int {
-        return fwrite($stream, $data);
-    }
-
-    function waitForWrite(...$streams) : bool {
-        $read = null;
-        $except = null;
-        while($streams && !($n = stream_select($read, $streams, $except, 1)));
-        return $n > 0;
-    }
-
-    function waitForRead(...$streams) : bool {
-        $write = null;
-        $except = null;
-        while ($streams && !($n = stream_select($streams, $write, $except, 1)));
-        return $n > 0;
-    }
-
-    set_error_handler(function ($errno, $errstr) {
-        exit("$errstr\n");
-    });
-
-    $serverUri = "tcp://127.0.0.1:64321";
-    $clientFlags = STREAM_CLIENT_CONNECT;
-    $clientCtx = stream_context_create(['ssl' => [
-        'verify_peer' => true,
-        'cafile' => __DIR__ . '/bug54992-ca.pem',
-        'peer_name' => 'bug54992.local',
-    ]]);
-
-    phpt_wait();
-
-    $fp = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
-
-    stream_set_blocking($fp, false);
-    while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_ANY_CLIENT)));
-
-    $data = str_repeat("a", 0xfffff);
-    $written = 0;
-    $total = $written;
-    while(!empty($data)) {
-        $written = streamWrite($fp, $data);
-        $total += $written;
-        $data = substr($data, $written);
-        waitForWrite($fp);
-    }
-    printf("Written %d bytes\n", $total);
-
-    while(waitForRead($fp)) {
-        streamRead($fp);
-        if (feof($fp)) {
-            break;
-        }
-    }
-
-    exit("DONE\n");
-CODE;
-
-include 'ServerClientTestCase.inc';
-ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
---EXPECTF--
-Written 1048575 bytes
-DONE
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 9dd402a..b4387cd 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1666,16 +1666,6 @@ int php_openssl_setup_crypto(php_stream *stream,
 		SSL_set_mode(sslsock->ssl_handle, mode | SSL_MODE_RELEASE_BUFFERS);
 	} while (0);
 #endif
-	
-	do {
-		long mode = SSL_get_mode(sslsock->ssl_handle);
-		SSL_set_mode(sslsock->ssl_handle, mode | SSL_MODE_ENABLE_PARTIAL_WRITE);
-	} while (0);
-	
-	do {
-		long mode = SSL_get_mode(sslsock->ssl_handle);
-		SSL_set_mode(sslsock->ssl_handle, mode | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
-	} while (0);
 
 	if (cparam->inputs.session) {
 		if (cparam->inputs.session->ops != &php_openssl_socket_ops) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.