mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-20 17:46:03 +02:00
Updates to EPP server to match RST
This commit is contained in:
parent
8ac4875c9c
commit
98ae5dc19c
1 changed files with 436 additions and 419 deletions
|
@ -21,6 +21,9 @@ use Swoole\Timer;
|
|||
use Swoole\Coroutine\Server;
|
||||
use Swoole\Coroutine\Server\Connection;
|
||||
use Namingo\Rately\Rately;
|
||||
use Selective\XmlDSig\PublicKeyStore;
|
||||
use Selective\XmlDSig\CryptoVerifier;
|
||||
use Selective\XmlDSig\XmlSignatureVerifier;
|
||||
|
||||
$table = new Table(1024);
|
||||
$table->column('clid', Table::TYPE_STRING, 64);
|
||||
|
@ -150,17 +153,30 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
|
|||
$conn->close();
|
||||
break;
|
||||
}
|
||||
$data = $conn->recv();
|
||||
$connId = spl_object_id($conn);
|
||||
|
||||
if ($data === false || strlen($data) < 4) {
|
||||
sendEppError($conn, $pdo, 2000, 'Invalid or no data received');
|
||||
static $buffer = '';
|
||||
|
||||
$chunk = $conn->recv();
|
||||
if ($chunk === '' || $chunk === false) {
|
||||
$conn->close();
|
||||
break;
|
||||
}
|
||||
$buffer .= $chunk;
|
||||
|
||||
$length = unpack('N', substr($data, 0, 4))[1];
|
||||
$xmlData = substr($data, 4, $length - 4);
|
||||
while (strlen($buffer) >= 4) {
|
||||
$len = unpack('N', substr($buffer, 0, 4))[1];
|
||||
if ($len < 5) {
|
||||
sendEppError($conn, $pdo, 2000, 'Invalid frame length');
|
||||
$conn->close();
|
||||
break 2;
|
||||
}
|
||||
if (strlen($buffer) < $len) {
|
||||
break;
|
||||
}
|
||||
|
||||
$xmlData = substr($buffer, 4, $len - 4);
|
||||
$buffer = substr($buffer, $len);
|
||||
|
||||
// If you're using PHP < 8.0
|
||||
libxml_disable_entity_loader(true);
|
||||
|
@ -622,6 +638,7 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
// Handle database exceptions
|
||||
$log->alert('Database error: ' . $e->getMessage());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue