改名
This commit is contained in:
@@ -71,6 +71,7 @@ class Client extends ClientAbstracts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $host
|
* @param $host
|
||||||
@@ -85,27 +86,39 @@ class Client extends ClientAbstracts
|
|||||||
} else {
|
} else {
|
||||||
$client = new SClient($host, $this->getPort(), false);
|
$client = new SClient($host, $this->getPort(), false);
|
||||||
}
|
}
|
||||||
if (strpos($path, '/') !== 0) {
|
|
||||||
$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());
|
||||||
}
|
}
|
||||||
$client->setHeaders($this->getHeader());
|
$client->setHeaders($this->getHeader());
|
||||||
$client->setMethod(strtoupper($this->getMethod()));
|
$client->setMethod(strtoupper($this->getMethod()));
|
||||||
if ($this->isGet() && !empty($data)) {
|
$client->execute($this->setParams($client, $path, $data));
|
||||||
$path .= '?' . $data;
|
$client->close();
|
||||||
} else {
|
return $client;
|
||||||
$this->setData($this->mergeParams($data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $client
|
||||||
|
* @param $path
|
||||||
|
* @param $data
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function setParams(SClient $client, $path, $data): string
|
||||||
|
{
|
||||||
|
if ($this->isGet()) {
|
||||||
|
if (!empty($data)) $path .= '?' . $data;
|
||||||
if (!empty($this->getData())) {
|
if (!empty($this->getData())) {
|
||||||
$client->setData($this->getData());
|
$client->setData($this->getData());
|
||||||
}
|
}
|
||||||
$client->execute($path);
|
} else {
|
||||||
$client->close();
|
if (!empty($this->getData())) {
|
||||||
return $client;
|
$client->setData($this->getData());
|
||||||
|
} else {
|
||||||
|
$client->setData($this->mergeParams($data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -676,6 +676,15 @@ abstract class ClientAbstracts extends Component implements IClient
|
|||||||
return strtolower($this->method) === self::POST;
|
return strtolower($this->method) === self::POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
* check isPost Request
|
||||||
|
*/
|
||||||
|
#[Pure] public function isUpload(): bool
|
||||||
|
{
|
||||||
|
return strtolower($this->method) === self::UPLOAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ class Event extends BaseObject
|
|||||||
|
|
||||||
private static array $_events = [];
|
private static array $_events = [];
|
||||||
|
|
||||||
const EVENT_ERROR = 'WORKER:ERROR';
|
|
||||||
const EVENT_STOP = 'WORKER:STOP';
|
|
||||||
const EVENT_EXIT = 'WORKER:EXIT';
|
|
||||||
|
|
||||||
const PIPE_MESSAGE = 'SERVER:PIPE:MESSAGE';
|
const PIPE_MESSAGE = 'SERVER:PIPE:MESSAGE';
|
||||||
const TASK_FINISH = 'SERVER:TASK::FINISH';
|
const TASK_FINISH = 'SERVER:TASK::FINISH';
|
||||||
|
|||||||
Reference in New Issue
Block a user