This commit is contained in:
2023-10-27 22:23:11 +08:00
parent 165f62113c
commit 7b14fa075e
3 changed files with 677 additions and 638 deletions
+666 -638
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -115,6 +115,11 @@ class CurlClient extends ClientAbstracts
if ($method === self::POST || $method == self::UPLOAD) {
curl_setopt($resource, CURLOPT_POST, 1);
}
[$proxy, $port] = [$this->getProxyHost(), $this->getProxyPort()];
if (!empty($proxy) && $port > 0) {
curl_setopt($resource, CURLOPT_PROXYPORT, $port);
curl_setopt($resource, CURLOPT_PROXY, $proxy);
}
curl_setopt($resource, CURLOPT_CUSTOMREQUEST, strtoupper($method));
$this->client = $resource;
if (!empty($this->caPath)) {
+6
View File
@@ -19,6 +19,12 @@ trait TSwooleClient
if ($this->getConnectTimeout() > 0) {
$params['timeout'] = $this->getConnectTimeout();
}
[$proxy, $port] = [$this->getProxyHost(), $this->getProxyPort()];
if (!empty($proxy) && $port > 0) {
$params['http_proxy_host'] = $proxy;
$params['http_proxy_port'] = $port;
}
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
return $params;
}