Skip to content

Commit

Permalink
Merge pull request #25 from apple-x-co/tls
Browse files Browse the repository at this point in the history
Add TLS verify ignore option
  • Loading branch information
apple-x-co authored Mar 24, 2023
2 parents 3b847a9 + b714ddb commit ab227e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/Command/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ public function execute()
./rocket.phar [options]
Options:
-c, --config {file name} Configuration file name as JSON
-g, --git [pull] Git operation
-h, --help Display this help message
-i, --init [plain|cakephp3|eccube4|wordpress] Print sample configuration file
-n, --notify Simple slack notification
--notify-test Slack notification test
--no-color Without color
-s, --sync [dry|confirm|force] Rsync operation
--ssl [IGNORE_VERIFY|TLSv1_0|TLSv1_1|TLSv1_2|TLSv1_3] SSL Version
-u, --upgrade Download new version file
--unzip {path} Using zip command on upgrade
-v, --verify Verify configuration file
-c, --config {file name} Configuration file name as JSON
-g, --git [pull] Git operation
-h, --help Display this help message
-i, --init [plain|cakephp3|eccube4|wordpress] Print sample configuration file
-n, --notify Simple slack notification
--notify-test Slack notification test
--no-color Without color
-s, --sync [dry|confirm|force] Rsync operation
--ssl [TLSv1_0|TLSv1_1|TLSv1_2|TLSv1_3] SSL Version
-u, --upgrade Download new version file
--unzip {path} Using zip command on upgrade
-v, --verify Verify configuration file
EOT;

Expand Down
11 changes: 8 additions & 3 deletions src/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@

class Http
{
/** @var 'IGNORE_VERIFY'|'TLSv1_0'|'TLSv1_1'|'TLSv1_2'|'TLSv1_3'|null */
/** @var 'TLSv1_0'|'TLSv1_1'|'TLSv1_2'|'TLSv1_3'|null */
private $ssl;

/** @var bool */
private $ignoreVerify;

/**
* @param string|null $ssl
* @param bool $ignoreVerify
*/
public function __construct($ssl)
public function __construct($ssl, $ignoreVerify = true)
{
$this->ssl = $ssl;
$this->ignoreVerify = $ignoreVerify;
}

public function setupCurl($ch)
Expand All @@ -29,7 +34,7 @@ public function setupCurl($ch)
return;
}

if ($this->ssl === 'IGNORE_VERIFY') {
if ($this->ignoreVerify) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
Expand Down

0 comments on commit ab227e1

Please sign in to comment.