Skip to content

Commit 2dd90db

Browse files
committed
Fix swoole_runtime/ssl tests
1 parent 6d35c00 commit 2dd90db

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

ext-src/swoole_runtime.cc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,19 +781,15 @@ static int socket_enable_crypto(php_stream *stream, Socket *sock, php_stream_xpo
781781
if (!sock->ssl_handshake()) {
782782
return -1;
783783
}
784-
zval *val = php_stream_context_get_option(context, "ssl", "capture_peer_cert");
785-
if (val && zend_is_true(val) && !php_openssl_capture_peer_certs(stream, sock)) {
786-
return -1;
787-
}
788-
/**
789-
* returns 1: The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.
790-
*/
791-
return 1;
792784
} else if (!cparam->inputs.activate && sock->ssl_is_available()) {
793785
sock->ssl_shutdown();
794786
return -1;
795787
}
796788

789+
zval *val = php_stream_context_get_option(context, "ssl", "capture_peer_cert");
790+
if (val && zend_is_true(val) && !php_openssl_capture_peer_certs(stream, sock)) {
791+
return -1;
792+
}
797793
return 1;
798794
}
799795
#endif

include/swoole_coroutine_socket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class Socket {
148148
return ssl_context.get();
149149
}
150150

151-
bool ssl_listen();
152151
bool ssl_handshake();
153152
bool ssl_verify(bool allow_self_signed);
154153
std::string ssl_get_peer_cert();
@@ -443,6 +442,7 @@ class Socket {
443442
std::string ssl_host_name;
444443
bool ssl_context_create();
445444
bool ssl_create(SSLContext *ssl_context);
445+
bool ssl_listen();
446446
#endif
447447

448448
bool connected = false;

tests/swoole_runtime/capture_peer_cert.phpt renamed to tests/swoole_runtime/ssl/capture_peer_cert.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
--TEST--
2-
swoole_runtime: ssl capture_peer_cert
2+
swoole_runtime/ssl: capture_peer_cert
33
--SKIPIF--
44
<?php
5-
require __DIR__ . '/../include/skipif.inc';
5+
require __DIR__ . '/../../include/skipif.inc';
66
skip_if_no_ssl();
77
skip_if_offline();
88
?>
99
--FILE--
1010
<?php
11-
require __DIR__ . '/../include/bootstrap.php';
11+
require __DIR__ . '/../../include/bootstrap.php';
1212

1313
function capture_peer_cert($domain)
1414
{
@@ -32,7 +32,7 @@ function capture_peer_cert($domain)
3232

3333
Swoole\Runtime::setHookFlags(SWOOLE_HOOK_ALL);
3434

35-
Co\run(function () {
35+
Co\run(function () {
3636
$result = capture_peer_cert('www.baidu.com');
3737
$info1 = openssl_x509_parse($result["options"]["ssl"]["peer_certificate"]);
3838
Assert::isArray($info1);

tests/swoole_runtime/ssl_client.phpt renamed to tests/swoole_runtime/ssl/client.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
swoole_runtime: ssl client
33
--SKIPIF--
44
<?php
5-
require __DIR__ . '/../include/skipif.inc';
5+
require __DIR__ . '/../../include/skipif.inc';
66
skip_if_no_ssl();
77
skip_if_offline();
88
?>
99
--FILE--
1010
<?php
11-
require __DIR__ . '/../include/bootstrap.php';
11+
require __DIR__ . '/../../include/bootstrap.php';
1212

1313
Swoole\Runtime::enableCoroutine();
1414

tests/swoole_runtime/ssl_server.phpt renamed to tests/swoole_runtime/ssl/server.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
swoole_runtime: ssl server
33
--SKIPIF--
44
<?php
5-
require __DIR__ . '/../include/skipif.inc';
5+
require __DIR__ . '/../../include/skipif.inc';
66
skip_if_no_ssl();
77
?>
88
--FILE--
99
<?php
10-
require __DIR__ . '/../include/bootstrap.php';
10+
require __DIR__ . '/../../include/bootstrap.php';
1111

1212
Swoole\Runtime::enableCoroutine();
1313

0 commit comments

Comments
 (0)