feat(compat): sweep of components against the real core with strict diagnostics
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
// Router de compatibilidad del paquete http: curlRequest con flujo completo
|
||||
// (se llama a si mismo via el mismo servidor) y carga nivel 1 de los clientes
|
||||
// con servicio externo.
|
||||
|
||||
use Libs\Aria2;
|
||||
use Libs\CompreFace;
|
||||
use Libs\CurlRequest;
|
||||
use Libs\Proxy;
|
||||
use Libs\Router;
|
||||
|
||||
Router::get('/compat/http/echo', function () {
|
||||
echo 'ECHO:' . ($_GET['who'] ?? 'nadie');
|
||||
});
|
||||
|
||||
Router::get('/compat/http/curl', function () {
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$req = new CurlRequest();
|
||||
$req->get("http://$host/compat/http/echo?who=42");
|
||||
echo str_contains($req->body(), 'ECHO:42') ? 'CURL_OK' : 'CURL_FAIL:' . substr($req->body(), 0, 80);
|
||||
});
|
||||
|
||||
Router::get('/compat/http/load', function () {
|
||||
$class = 'Libs\\' . basename((string) ($_GET['class'] ?? ''));
|
||||
if (!class_exists($class)) {
|
||||
echo 'LOAD_MISSING';
|
||||
return;
|
||||
}
|
||||
$instance = match ($class) {
|
||||
'Libs\\Aria2' => new Aria2('http://127.0.0.1:6800/jsonrpc'),
|
||||
'Libs\\CompreFace' => new CompreFace('compat-key', 'http://127.0.0.1:18080'),
|
||||
default => new $class(),
|
||||
};
|
||||
echo 'LOAD_OK:' . get_class($instance);
|
||||
});
|
||||
Reference in New Issue
Block a user