新增功能
This commit is contained in:
+21
@@ -39,9 +39,30 @@ class HttpConnection
|
||||
$options = ["allow_redirects" => false];
|
||||
$options["timeout"] = $this->profile->getHttpProfile()->getReqTimeout();
|
||||
$options["proxy"] = $this->profile->getHttpProfile()->getProxy();
|
||||
// 显式传入 CA 包,避免 Windows 上 Guzzle 对 defaultCaBundle() 的静态缓存早于 ini_set 导致 cURL 60
|
||||
$cafile = $this->resolveVerifyCafile();
|
||||
if ($cafile !== '') {
|
||||
$options['verify'] = $cafile;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
private function resolveVerifyCafile(): string
|
||||
{
|
||||
$fromEnv = getenv('TRTC_RECORDING_SSL_CAFILE');
|
||||
if (is_string($fromEnv) && $fromEnv !== '' && is_readable($fromEnv)) {
|
||||
return $fromEnv;
|
||||
}
|
||||
// vendor/tencentcloud/common/src/TencentCloud/Common/Http → 上 7 层到应用根(含 composer vendor 目录)
|
||||
$root = dirname(__DIR__, 7);
|
||||
$candidate = $root . DIRECTORY_SEPARATOR . 'cacert.pem';
|
||||
if (is_readable($candidate)) {
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getRequest($uri = '', $query = [], $headers = [])
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
|
||||
Reference in New Issue
Block a user