diff --git a/app/Client/Http/HttpClient.php b/app/Client/Http/HttpClient.php index fa3d4af..f486426 100644 --- a/app/Client/Http/HttpClient.php +++ b/app/Client/Http/HttpClient.php @@ -54,7 +54,7 @@ public function performRequest(string $requestData, WebSocket $proxyConnection = $request = $this->passRequestThroughModifiers(parse_request($requestData), $proxyConnection); - transform($request, function ($request) use ($proxyConnection) { + return transform($request, function ($request) use ($proxyConnection) { return $this->sendRequestToApplication($request, $proxyConnection); }); } diff --git a/app/Client/ProxyManager.php b/app/Client/ProxyManager.php index 66699c6..26dacd6 100644 --- a/app/Client/ProxyManager.php +++ b/app/Client/ProxyManager.php @@ -36,8 +36,6 @@ public function createProxy(string $clientId, $connectionData) $localRequestConnection = null; $proxyConnection->on('message', function ($message) use (&$localRequestConnection, $proxyConnection, $connectionData) { - $this->performRequest($proxyConnection, (string) $message, $connectionData); - if ($localRequestConnection) { $localRequestConnection->write($message); return; diff --git a/app/Server/Http/Controllers/TunnelMessageController.php b/app/Server/Http/Controllers/TunnelMessageController.php index 4a305a4..0cd224a 100644 --- a/app/Server/Http/Controllers/TunnelMessageController.php +++ b/app/Server/Http/Controllers/TunnelMessageController.php @@ -91,8 +91,8 @@ protected function sendRequestToClient(Request $request, ControlConnection $cont $httpConnection = $this->connectionManager->storeHttpConnection($httpConnection, $requestId); - transform($this->passRequestThroughModifiers($request, $httpConnection), function (Request $request) use ($controlConnection, $requestId) { - $controlConnection->once('proxy_ready_'.$requestId, function (ConnectionInterface $proxy) use ($request) { + transform($this->passRequestThroughModifiers($request, $httpConnection), function (Request $request) use ($httpConnection, $controlConnection, $requestId) { + $controlConnection->once('proxy_ready_'.$requestId, function (ConnectionInterface $proxy) use ($httpConnection, $request) { // Convert the Laravel request into a PSR7 request $psr17Factory = new Psr17Factory(); $psrHttpFactory = new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);