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;
|
||||||
use Swoole\Coroutine\Server\Connection;
|
use Swoole\Coroutine\Server\Connection;
|
||||||
use Namingo\Rately\Rately;
|
use Namingo\Rately\Rately;
|
||||||
|
use Selective\XmlDSig\PublicKeyStore;
|
||||||
|
use Selective\XmlDSig\CryptoVerifier;
|
||||||
|
use Selective\XmlDSig\XmlSignatureVerifier;
|
||||||
|
|
||||||
$table = new Table(1024);
|
$table = new Table(1024);
|
||||||
$table->column('clid', Table::TYPE_STRING, 64);
|
$table->column('clid', Table::TYPE_STRING, 64);
|
||||||
|
@ -150,17 +153,30 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
|
||||||
$conn->close();
|
$conn->close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$data = $conn->recv();
|
|
||||||
$connId = spl_object_id($conn);
|
$connId = spl_object_id($conn);
|
||||||
|
|
||||||
if ($data === false || strlen($data) < 4) {
|
static $buffer = '';
|
||||||
sendEppError($conn, $pdo, 2000, 'Invalid or no data received');
|
|
||||||
|
$chunk = $conn->recv();
|
||||||
|
if ($chunk === '' || $chunk === false) {
|
||||||
$conn->close();
|
$conn->close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$buffer .= $chunk;
|
||||||
|
|
||||||
$length = unpack('N', substr($data, 0, 4))[1];
|
while (strlen($buffer) >= 4) {
|
||||||
$xmlData = substr($data, 4, $length - 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
|
// If you're using PHP < 8.0
|
||||||
libxml_disable_entity_loader(true);
|
libxml_disable_entity_loader(true);
|
||||||
|
@ -622,6 +638,7 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// Handle database exceptions
|
// Handle database exceptions
|
||||||
$log->alert('Database error: ' . $e->getMessage());
|
$log->alert('Database error: ' . $e->getMessage());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue