diff --git a/src/Http/Implementation/ReactPhpServer.php b/src/Http/Implementation/ReactPhpServer.php index 7432f13..995875e 100644 --- a/src/Http/Implementation/ReactPhpServer.php +++ b/src/Http/Implementation/ReactPhpServer.php @@ -29,6 +29,9 @@ use Psr\Log\LoggerInterface; use React\EventLoop\Factory as EventLoop; use React\EventLoop\LoopInterface; +use React\Http\Middleware\RequestBodyBufferMiddleware; +use React\Http\Middleware\RequestBodyParserMiddleware; +use React\Http\Middleware\StreamingRequestMiddleware; use React\Http\Server; use React\Socket\Server as ReactSocket; @@ -60,6 +63,9 @@ public function listen(HostInterface $host, Port $port, ?SecureOptions $secureOp { $this->http = new Server( $this->loop, + new StreamingRequestMiddleware(), + new RequestBodyBufferMiddleware(), + new RequestBodyParserMiddleware(), function (ServerRequestInterface $request) { return $this->onRequest($request); } @@ -70,7 +76,7 @@ function (ServerRequestInterface $request) { $this->http->listen($this->socket); // Dispatch pending signals periodically - if (function_exists('pcntl_signal_dispatch')) { + if (\function_exists('pcntl_signal_dispatch')) { $this->loop->addPeriodicTimer(0.5, function () { pcntl_signal_dispatch(); });