From 6af1e2661b76da9f09a5923873ec06602b8a14aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Sat, 13 Sep 2025 23:04:28 +0200 Subject: [PATCH] fix: catch libcurl unexpected EOF while reading exception --- src/Entity/IcannAccreditation.php | 4 ++-- src/Service/RDAPService.php | 10 +++++++--- tsconfig.json | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Entity/IcannAccreditation.php b/src/Entity/IcannAccreditation.php index bc6f812..541d123 100644 --- a/src/Entity/IcannAccreditation.php +++ b/src/Entity/IcannAccreditation.php @@ -24,11 +24,11 @@ class IcannAccreditation private ?RegistrarStatus $status = null; #[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)] - #[Groups(['entity:item', 'domain:item'])] + #[Groups(['entity:item', 'entity:list', 'domain:item'])] private ?\DateTimeImmutable $updated = null; #[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)] - #[Groups(['entity:item', 'domain:item'])] + #[Groups(['entity:item', 'entity:list', 'domain:item'])] private ?\DateTimeImmutable $date = null; public function getRegistrarName(): ?string diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index a1a3bf8..05766e4 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -43,6 +43,7 @@ use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; class RDAPService { @@ -248,7 +249,7 @@ class RDAPService return $req->toArray(); } catch (\Exception $e) { - throw $this->handleRdapException($e, $idnDomain, $domain); + throw $this->handleRdapException($e, $idnDomain, $domain, $req ?? null); } finally { if ($this->influxdbEnabled && isset($req)) { $this->influxService->addRdapQueryPoint($rdapServer, $idnDomain, $req->getInfo()); @@ -260,9 +261,12 @@ class RDAPService * @throws TransportExceptionInterface * @throws \Exception */ - private function handleRdapException(\Exception $e, string $idnDomain, ?Domain $domain): \Exception + private function handleRdapException(\Exception $e, string $idnDomain, ?Domain $domain, ?ResponseInterface $response): \Exception { - if ($e instanceof ClientException && 404 === $e->getResponse()->getStatusCode()) { + if ( + ($e instanceof ClientException && 404 === $e->getResponse()->getStatusCode()) + || ($e instanceof TransportExceptionInterface && null !== $response && !in_array('content-length', $response->getHeaders(false))) + ) { if (null !== $domain) { $this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [ 'idnDomain' => $idnDomain, diff --git a/tsconfig.json b/tsconfig.json index c0fbde2..293c3ca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "strict": true }, "exclude": [ - "node_modules" + "node_modules", + "vendor/**/*.ts" ] } \ No newline at end of file