Skip to content

Commit

Permalink
Fixes "Incorrect header size" (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored Jul 13, 2023
1 parent 5fa985d commit 6b4db3a
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions bin/roadrunner-worker
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use Laravel\Octane\RoadRunner\RoadRunnerClient;
use Laravel\Octane\Stream;
use Laravel\Octane\Worker;
use Psr\Http\Message\ServerRequestInterface;
use Spiral\Goridge\Exception\RelayException;
use Spiral\Goridge\Relay;
use Spiral\RoadRunner\Http\PSR7Worker;
use Spiral\RoadRunner\Worker as RoadRunnerWorker;
Expand All @@ -36,28 +37,30 @@ $roadRunnerClient = new RoadRunnerClient($psr7Client = new PSR7Worker(

$worker = null;

while ($psr7Request = $psr7Client->waitRequest()) {
try {
try {
while ($psr7Request = $psr7Client->waitRequest()) {
$worker = $worker ?: tap((new Worker(
new ApplicationFactory($basePath), $roadRunnerClient
)))->boot();
} catch (Throwable $e) {
Stream::shutdown($e);

exit(1);
}

if (! $psr7Request instanceof ServerRequestInterface) {
break;
}
if (! $psr7Request instanceof ServerRequestInterface) {
break;
}

[$request, $context] = $roadRunnerClient->marshalRequest(new RequestContext([
'psr7Request' => $psr7Request
]));
[$request, $context] = $roadRunnerClient->marshalRequest(new RequestContext([
'psr7Request' => $psr7Request,
]));

$worker->handle($request, $context);
}
$worker->handle($request, $context);
}
} catch (Throwable $e) {
if (! $e instanceof RelayException) {
$worker ? report($e) : Stream::shutdown($e);
}

if (! is_null($worker)) {
$worker->terminate();
exit(1);
} finally {
if (! is_null($worker)) {
$worker->terminate();
}
}

0 comments on commit 6b4db3a

Please sign in to comment.