add more
This commit is contained in:
@@ -162,7 +162,7 @@ final class AgentClient
|
||||
return;
|
||||
}
|
||||
|
||||
$this->send(new Frame(FrameType::DATA, $sessionId, ['data' => base64_encode($data)]));
|
||||
$this->send(new Frame(FrameType::DATA, $sessionId, ['data_raw' => $data]));
|
||||
}
|
||||
|
||||
private function handleInitialRequest(TcpConnection $connection, string $data): void
|
||||
@@ -544,7 +544,7 @@ final class AgentClient
|
||||
$pending = $this->pendingData[$frame->sessionId] ?? '';
|
||||
unset($this->pendingData[$frame->sessionId]);
|
||||
if ($pending !== '') {
|
||||
$this->send(new Frame(FrameType::DATA, $frame->sessionId, ['data' => base64_encode($pending)]));
|
||||
$this->send(new Frame(FrameType::DATA, $frame->sessionId, ['data_raw' => $pending]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ final class AgentClient
|
||||
return;
|
||||
}
|
||||
|
||||
$data = base64_decode((string)($frame->payload['data'] ?? ''), true);
|
||||
$data = $this->frameData($frame);
|
||||
if ($data === false) {
|
||||
$this->send(new Frame(FrameType::ERROR, $frame->sessionId, ['reason' => 'invalid_frame']));
|
||||
return;
|
||||
@@ -582,6 +582,15 @@ final class AgentClient
|
||||
$this->clients[$frame->sessionId]->send($data);
|
||||
}
|
||||
|
||||
private function frameData(Frame $frame): string|false
|
||||
{
|
||||
if (isset($frame->payload['data_raw']) && is_string($frame->payload['data_raw'])) {
|
||||
return $frame->payload['data_raw'];
|
||||
}
|
||||
|
||||
return base64_decode((string)($frame->payload['data'] ?? ''), true);
|
||||
}
|
||||
|
||||
private function onClientClose(TcpConnection $connection): void
|
||||
{
|
||||
unset($this->initialBuffers[$connection->id]);
|
||||
|
||||
Reference in New Issue
Block a user