Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Dec 15, 2023
1 parent 5047486 commit 35a4785
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Sender/Frontend/ConnectionPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Buggregator\Trap\Traffic\Websocket\Frame;
use Buggregator\Trap\Traffic\Websocket\Opcode;
use Buggregator\Trap\Traffic\Websocket\StreamReader;
use DateTimeImmutable;
use Fiber;
use IteratorAggregate;
use JsonSerializable;
Expand Down Expand Up @@ -87,6 +88,7 @@ public function send(Frame $frame): void
private function processSocket(StreamClient $stream): void
{
$pingTimer = null;
$lastPong = new DateTimeImmutable();

foreach (StreamReader::readFrames($stream->getIterator()) as $frame) {
// Connection close
Expand All @@ -99,7 +101,7 @@ private function processSocket(StreamClient $stream): void

// Pong using `{}` message
if ($frame->content === '{}') {
$stream->sendData($this->packPayload('{}'));
$lastPong = new DateTimeImmutable();
continue;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Sender/Frontend/Mapper/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function map(HttpFrame $frame): Event
'method' => $request->getMethod(),
'uri' => $uri,
'headers' => $request->getHeaders(),
'body' => (string)$request->getBody(),
'body' => $request->getParsedBody() === null
? (string)$request->getBody()
: '',
'query' => $request->getQueryParams(),
'post' => $request->getParsedBody() ?? [],
'cookies' => $request->getCookieParams(),
Expand Down

0 comments on commit 35a4785

Please sign in to comment.