]> granicus.if.org Git - php/commitdiff
Use spaces instead of tabs in bug 77390 test
authorJakub Zelenka <bukka@php.net>
Sun, 24 Feb 2019 13:05:43 +0000 (13:05 +0000)
committerJakub Zelenka <bukka@php.net>
Sun, 24 Feb 2019 13:05:43 +0000 (13:05 +0000)
ext/openssl/tests/bug77390.phpt

index a71275ef6f356626d8b5c9802f7d7768321c35bc..2aa2b15b41bb7a3bcb2653d78d680ce7e5c78a0b 100644 (file)
@@ -12,97 +12,97 @@ $cacertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug77390-ca.pem.tmp';
 
 $peerName = 'bug77390';
 $clientCode = <<<'CODE'
-       $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => '%s']]);
-
-       phpt_wait('server');
-       phpt_notify('proxy');
-       
-       phpt_wait('proxy');
-       $fp = stream_socket_client("ssl://127.0.0.1:10012", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
-       stream_set_blocking($fp, false);
-
-       $read = [$fp];
-       $buf = '';
-       $warmedUp = false;
-       while (stream_select($read, $write, $except, 1000)) {
-               $chunk = stream_get_contents($fp, 4096);
-               $buf .= $chunk;
-               phpt_notify('proxy');
-               if (!$warmedUp) {
-                       if ($buf !== 'warmup') {
-                               continue;
-                       }
-                       $warmedUp = true;
-                       $buf = '';
-                       phpt_notify('server');
-                       continue;
-               }
-               var_dump($chunk);
-               if ($buf === 'hello, world') {
-                       break;
-               }
-       }
-       
-       phpt_notify('server');
-       phpt_notify('proxy');
+    $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => '%s']]);
+
+    phpt_wait('server');
+    phpt_notify('proxy');
+
+    phpt_wait('proxy');
+    $fp = stream_socket_client("ssl://127.0.0.1:10012", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
+    stream_set_blocking($fp, false);
+
+    $read = [$fp];
+    $buf = '';
+    $warmedUp = false;
+    while (stream_select($read, $write, $except, 1000)) {
+        $chunk = stream_get_contents($fp, 4096);
+        $buf .= $chunk;
+        phpt_notify('proxy');
+        if (!$warmedUp) {
+            if ($buf !== 'warmup') {
+                continue;
+            }
+            $warmedUp = true;
+            $buf = '';
+            phpt_notify('server');
+            continue;
+        }
+        var_dump($chunk);
+        if ($buf === 'hello, world') {
+            break;
+        }
+    }
+
+    phpt_notify('server');
+    phpt_notify('proxy');
 CODE;
 $clientCode = sprintf($clientCode, $peerName);
 
 $serverCode = <<<'CODE'
-       $context = stream_context_create(['ssl' => ['local_cert' => '%s']]);
-
-       $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
-       $fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
-       phpt_notify();
-       
-       $conn = stream_socket_accept($fp);
-       fwrite($conn, 'warmup');
-       phpt_wait();
-       fwrite($conn, 'hello, world');
-       
-       phpt_wait();
-       fclose($conn);
+    $context = stream_context_create(['ssl' => ['local_cert' => '%s']]);
+
+    $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
+    $fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
+    phpt_notify();
+
+    $conn = stream_socket_accept($fp);
+    fwrite($conn, 'warmup');
+    phpt_wait();
+    fwrite($conn, 'hello, world');
+
+    phpt_wait();
+    fclose($conn);
 CODE;
 $serverCode = sprintf($serverCode, $certFile);
 
 $proxyCode = <<<'CODE'
-       phpt_wait();
-
-       $upstream = stream_socket_client("tcp://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT);
-       stream_set_blocking($upstream, false);
-
-       $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
-       $server = stream_socket_server("tcp://127.0.0.1:10012", $errornum, $errorstr, $flags);
-       phpt_notify();
-       
-       $conn = stream_socket_accept($server);
-       stream_set_blocking($conn, false);
-       
-       $read = [$upstream, $conn];
-       while (stream_select($read, $write, $except, 1)) {
-               foreach ($read as $fp) {
-                       $data = stream_get_contents($fp);
-                       if ($fp === $conn) {
-                               fwrite($upstream, $data);
-                       } else {
-                               if ($data !== '' && $data[0] === chr(23)) {
-                                       $parts = str_split($data, (int) ceil(strlen($data) / 3));
-                                       foreach ($parts as $part) {
-                                               fwrite($conn, $part);
-                                               phpt_wait(null, 1);
-                                       }
-                               } else {
-                                       fwrite($conn, $data);
-                               }
-                       }
-               }
-               if (feof($upstream)) {
-                       break;
-               }
-               $read = [$upstream, $conn];
-       }
-       
-       phpt_wait();
+    phpt_wait();
+
+    $upstream = stream_socket_client("tcp://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT);
+    stream_set_blocking($upstream, false);
+
+    $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
+    $server = stream_socket_server("tcp://127.0.0.1:10012", $errornum, $errorstr, $flags);
+    phpt_notify();
+
+    $conn = stream_socket_accept($server);
+    stream_set_blocking($conn, false);
+
+    $read = [$upstream, $conn];
+    while (stream_select($read, $write, $except, 1)) {
+        foreach ($read as $fp) {
+            $data = stream_get_contents($fp);
+            if ($fp === $conn) {
+                fwrite($upstream, $data);
+            } else {
+                if ($data !== '' && $data[0] === chr(23)) {
+                    $parts = str_split($data, (int) ceil(strlen($data) / 3));
+                    foreach ($parts as $part) {
+                        fwrite($conn, $part);
+                        phpt_wait(null, 1);
+                    }
+                } else {
+                    fwrite($conn, $data);
+                }
+            }
+        }
+        if (feof($upstream)) {
+            break;
+        }
+        $read = [$upstream, $conn];
+    }
+
+    phpt_wait();
 CODE;
 
 include 'CertificateGenerator.inc';
@@ -112,8 +112,8 @@ $certificateGenerator->saveNewCertAsFileWithKey($peerName, $certFile);
 
 include 'ServerClientTestCase.inc';
 ServerClientTestCase::getInstance()->run($clientCode, [
-       'server' => $serverCode,
-       'proxy' => $proxyCode,
+    'server' => $serverCode,
+    'proxy' => $proxyCode,
 ]);
 ?>
 --CLEAN--