Skip to content

Commit

Permalink
[1.x] Avoids usage of SWOOLE_SSL when openssl is not configured o…
Browse files Browse the repository at this point in the history
…n swoole (#357)

* Only uses SWOOLE_SSL if exists

* Adds guard

Co-Authored-By: 沈唁 <[email protected]>

Co-authored-by: 沈唁 <[email protected]>
  • Loading branch information
nunomaduro and sy-records authored Aug 5, 2021
1 parent 0a3968e commit 64a1c3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/createSwooleServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
$serverState['host'] ?? '127.0.0.1',
$serverState['port'] ?? '8080',
SWOOLE_PROCESS,
SWOOLE_SOCK_TCP | ((bool) ($config['swoole']['ssl'] ?? 0)) * SWOOLE_SSL,
($config['swoole']['ssl'] ?? false)
? SWOOLE_SOCK_TCP | SWOOLE_SSL
: SWOOLE_SOCK_TCP,
);
} catch (Throwable $e) {
Laravel\Octane\Stream::shutdown($e);
Expand Down
6 changes: 6 additions & 0 deletions src/Commands/StartSwooleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ public function handle(
return 1;
}

if (config('octane.swoole.ssl', false) === true && ! defined('SWOOLE_SSL')) {
$this->error('You must configure Swoole with `--enable-openssl` to support ssl.');

return 1;
}

$this->writeServerStateFile($serverStateFile, $extension);

$this->forgetEnvironmentVariables();
Expand Down

0 comments on commit 64a1c3c

Please sign in to comment.