diff --git a/wchat/common/Config.php b/wchat/common/Config.php index 88bdaa2..a810cfc 100644 --- a/wchat/common/Config.php +++ b/wchat/common/Config.php @@ -104,6 +104,8 @@ class Config private $ssl_cert = ''; private $ssl_key = ''; + private $ssl_ca = ''; + private $port = ''; /** * @var string @@ -113,6 +115,42 @@ class Config private $agent = ''; private $usrSwoole = false; + /** + * @return string + */ + public function getSslCa(): string + { + return $this->ssl_ca; + } + + /** + * @param string $ssl_ca + * @return Config + */ + public function setSslCa(string $ssl_ca): Config + { + $this->ssl_ca = $ssl_ca; + return $this; + } + + /** + * @return string + */ + public function getPort(): string + { + return $this->port; + } + + /** + * @param string $port + * @return Config + */ + public function setPort(string $port): Config + { + $this->port = $port; + return $this; + } + /** * @return bool */ diff --git a/wchat/common/Miniprogarampage.php b/wchat/common/Miniprogarampage.php index 6d30447..8900471 100644 --- a/wchat/common/Miniprogarampage.php +++ b/wchat/common/Miniprogarampage.php @@ -109,10 +109,13 @@ abstract class Miniprogarampage implements Progaram $this->request->setUseSwoole($config->isUsrSwoole()); $this->request->setAgent($config->getAgent()); if (!empty($config->getSslCert())) { - $this->request->addHeader('ssl_cert_file', $config->getSslCert()); + $this->request->setSslCertFile($config->getSslCert()); } if (!empty($config->getSslKey())) { - $this->request->addHeader('ssl_key_file', $config->getSslKey()); + $this->request->setSslKeyFile($config->getSslKey()); + } + if (!empty($config->getSslCa())) { + $this->request->setCa($config->getSslCa()); } return $this; }