fix: catch libcurl unexpected EOF while reading exception

This commit is contained in:
Maël Gangloff 2025-09-13 23:04:28 +02:00
parent 1b1b82189e
commit 6af1e2661b
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
3 changed files with 11 additions and 6 deletions

View File

@ -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

View File

@ -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,

View File

@ -10,6 +10,7 @@
"strict": true
},
"exclude": [
"node_modules"
"node_modules",
"vendor/**/*.ts"
]
}