From 816c3a83dfc09d2f135f3234583a52c42d6e8211 Mon Sep 17 00:00:00 2001 From: alwayshopeless <38844539+alwayshopeless@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:47:25 +0200 Subject: [PATCH] Update HttpClient.php [Issue #425 fix] Handling exception of failed header parsing when logging a request. --- app/Client/Http/HttpClient.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Client/Http/HttpClient.php b/app/Client/Http/HttpClient.php index 43aa142..9272d0c 100644 --- a/app/Client/Http/HttpClient.php +++ b/app/Client/Http/HttpClient.php @@ -6,6 +6,8 @@ use App\Client\Http\Modifiers\CheckBasicAuthentication; use App\Logger\RequestLogger; use GuzzleHttp\Psr7\Message; +use Illuminate\Support\Facades\Log; +use Laminas\Http\Header\Exception\RuntimeException; use Laminas\Http\Request; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -50,7 +52,11 @@ public function performRequest(string $requestData, WebSocket $proxyConnection = $this->request = $this->parseRequest($requestData); - $this->logger->logRequest($requestData, $this->request); + try { + $this->logger->logRequest($requestData, $this->request); + } catch (RuntimeException $exception) { + Log::error($exception->getMessage()); + } $request = $this->passRequestThroughModifiers(parse_request($requestData), $proxyConnection);