改名
This commit is contained in:
@@ -46,7 +46,6 @@ class Client extends ClientAbstracts
|
|||||||
private function coroutine($url, $data = [])
|
private function coroutine($url, $data = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var_dump($url);
|
|
||||||
$client = $this->generate_client($data, ...$url);
|
$client = $this->generate_client($data, ...$url);
|
||||||
if ($client->statusCode < 0) {
|
if ($client->statusCode < 0) {
|
||||||
throw new Exception($client->errMsg);
|
throw new Exception($client->errMsg);
|
||||||
@@ -79,13 +78,15 @@ class Client extends ClientAbstracts
|
|||||||
*/
|
*/
|
||||||
private function generate_client($data, $host, $isHttps, $path)
|
private function generate_client($data, $host, $isHttps, $path)
|
||||||
{
|
{
|
||||||
$port = $isHttps ? 443 : $this->getPort();
|
if ($isHttps || $this->isSSL()) {
|
||||||
$client = new SClient($host, $port, $this->isSSL());
|
$client = new SClient($host, 443, $this->isSSL());
|
||||||
|
} else {
|
||||||
|
$client = new SClient($host, $this->getPort(), $this->isSSL());
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($path, '/') !== 0) {
|
if (strpos($path, '/') !== 0) {
|
||||||
$path = '/' . $path;
|
$path = '/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->set($this->settings());
|
$client->set($this->settings());
|
||||||
if (!empty($this->getAgent())) {
|
if (!empty($this->getAgent())) {
|
||||||
$this->addHeader('User-Agent', $this->getAgent());
|
$this->addHeader('User-Agent', $this->getAgent());
|
||||||
@@ -93,7 +94,6 @@ class Client extends ClientAbstracts
|
|||||||
|
|
||||||
$client->setHeaders($this->getHeader());
|
$client->setHeaders($this->getHeader());
|
||||||
$client->setMethod(strtoupper($this->getMethod()));
|
$client->setMethod(strtoupper($this->getMethod()));
|
||||||
|
|
||||||
if (strtolower($this->getMethod()) == self::GET && !empty($data)) {
|
if (strtolower($this->getMethod()) == self::GET && !empty($data)) {
|
||||||
$path .= '?' . $data;
|
$path .= '?' . $data;
|
||||||
} else {
|
} else {
|
||||||
@@ -103,7 +103,6 @@ class Client extends ClientAbstracts
|
|||||||
if (!empty($this->getData())) {
|
if (!empty($this->getData())) {
|
||||||
$client->setData($this->getData());
|
$client->setData($this->getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->execute($path);
|
$client->execute($path);
|
||||||
$client->close();
|
$client->close();
|
||||||
return $client;
|
return $client;
|
||||||
|
|||||||
@@ -747,7 +747,6 @@ abstract class ClientAbstracts extends Component implements IClient
|
|||||||
private function defaultString($string)
|
private function defaultString($string)
|
||||||
{
|
{
|
||||||
$host = $this->getHost();
|
$host = $this->getHost();
|
||||||
$host .= ':' . $this->getPort();
|
|
||||||
if ($string == '/') {
|
if ($string == '/') {
|
||||||
$string = '';
|
$string = '';
|
||||||
} else if (strpos($string, '/') !== 0) {
|
} else if (strpos($string, '/') !== 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user