diff --git a/Annotation/Asynchronous.php b/Annotation/Asynchronous.php index 3b17b9da..0bdca270 100644 --- a/Annotation/Asynchronous.php +++ b/Annotation/Asynchronous.php @@ -5,7 +5,7 @@ namespace Annotation; use Exception; -use HttpServer\IInterface\Task; +use Http\IInterface\Task; use Kiri\Kiri; diff --git a/Annotation/Route/Filter.php b/Annotation/Route/Filter.php index 489dc26f..338a44f8 100644 --- a/Annotation/Route/Filter.php +++ b/Annotation/Route/Filter.php @@ -6,7 +6,7 @@ namespace Annotation\Route; use Annotation\Attribute; use Exception; -use HttpServer\HttpFilter; +use Http\HttpFilter; use ReflectionException; use Kiri\Exception\ComponentException; use Kiri\Exception\NotFindClassException; diff --git a/Annotation/Route/Middleware.php b/Annotation/Route/Middleware.php index fb3f48c3..63926c05 100644 --- a/Annotation/Route/Middleware.php +++ b/Annotation/Route/Middleware.php @@ -5,11 +5,11 @@ namespace Annotation\Route; use Annotation\Attribute; -use HttpServer\Route\MiddlewareManager; +use Http\Route\MiddlewareManager; use ReflectionException; use Kiri\Exception\NotFindClassException; use Kiri\Kiri; -use HttpServer\IInterface\Middleware as IMiddleware; +use Http\IInterface\Middleware as IMiddleware; /** * Class Middleware diff --git a/Annotation/Route/Route.php b/Annotation/Route/Route.php index d5a8a07b..68bf3a7d 100644 --- a/Annotation/Route/Route.php +++ b/Annotation/Route/Route.php @@ -6,7 +6,7 @@ namespace Annotation\Route; use Annotation\Attribute; use Exception; -use HttpServer\Route\Router; +use Http\Route\Router; use Kiri\Kiri; #[\Attribute(\Attribute::TARGET_METHOD)] class Route extends Attribute diff --git a/Annotation/Route/Socket.php b/Annotation/Route/Socket.php index 58871e8d..8ff77172 100644 --- a/Annotation/Route/Socket.php +++ b/Annotation/Route/Socket.php @@ -6,7 +6,7 @@ namespace Annotation\Route; use Annotation\Attribute; use Exception; -use HttpServer\Route\Router; +use Http\Route\Router; use Kiri\Kiri; /** diff --git a/Gii/Command.php b/Gii/Command.php index 7a5a7f05..464b6f59 100644 --- a/Gii/Command.php +++ b/Gii/Command.php @@ -12,7 +12,7 @@ use Kiri\Kiri; /** * Class Command - * @package HttpServer + * @package Http */ class Command extends \Console\Command { diff --git a/Gii/GiiController.php b/Gii/GiiController.php index 1949a8ee..400c098f 100644 --- a/Gii/GiiController.php +++ b/Gii/GiiController.php @@ -73,9 +73,9 @@ use Annotation\Route\Middleware; use Annotation\Route\Route; use Kiri\Core\Str; use Kiri\Core\Json; -use HttpServer\Http\Request; -use HttpServer\Http\Response; -use HttpServer\Controller; +use Http\Http\Request; +use Http\Http\Response; +use Http\Controller; use JetBrains\PhpStorm\ArrayShape; use {$model_namespace}\\{$managerName}; "; diff --git a/Gii/GiiInterceptor.php b/Gii/GiiInterceptor.php index af342381..08d4bfb2 100644 --- a/Gii/GiiInterceptor.php +++ b/Gii/GiiInterceptor.php @@ -47,8 +47,8 @@ namespace App\Http\Interceptor; } else { $html .= ' use Closure; -use HttpServer\Http\Request; -use HttpServer\IInterface\Interceptor; +use Http\Http\Request; +use Http\IInterface\Interceptor; '; } diff --git a/Gii/GiiLimits.php b/Gii/GiiLimits.php index c4aad2a0..798443eb 100644 --- a/Gii/GiiLimits.php +++ b/Gii/GiiLimits.php @@ -35,8 +35,8 @@ class GiiLimits extends GiiBase namespace App\Http\Limits; use Closure; -use HttpServer\Http\Request; -use HttpServer\IInterface\Limits; +use Http\Http\Request; +use Http\IInterface\Limits; '; diff --git a/Gii/GiiMiddleware.php b/Gii/GiiMiddleware.php index 4f53b50d..81e26c28 100644 --- a/Gii/GiiMiddleware.php +++ b/Gii/GiiMiddleware.php @@ -33,8 +33,8 @@ class GiiMiddleware extends GiiBase namespace App\Http\Middleware; use Closure; -use HttpServer\Http\Request; -use HttpServer\IInterface\Middleware; +use Http\Http\Request; +use Http\IInterface\Middleware; '; diff --git a/Gii/GiiRpcService.php b/Gii/GiiRpcService.php index b831fc31..2ad5f3b3 100644 --- a/Gii/GiiRpcService.php +++ b/Gii/GiiRpcService.php @@ -36,8 +36,8 @@ namespace App\Http\Rpc; use Annotation\Route\RpcProducer; use Annotation\Target; use Exception; -use HttpServer\Controller; -use HttpServer\Exception\RequestException; +use Http\Controller; +use Http\Exception\RequestException; use Kiri\Core\Json; '; diff --git a/Gii/GiiTask.php b/Gii/GiiTask.php index f2f0246e..2c5e7caa 100644 --- a/Gii/GiiTask.php +++ b/Gii/GiiTask.php @@ -31,7 +31,7 @@ class GiiTask extends GiiBase namespace App\Async; -use HttpServer\IInterface\Task; +use Http\IInterface\Task; '; diff --git a/Kafka/KafkaImports.php b/Kafka/KafkaImports.php index acc45b6f..aef17eae 100644 --- a/Kafka/KafkaImports.php +++ b/Kafka/KafkaImports.php @@ -5,7 +5,7 @@ namespace Kafka; use Exception; -use HttpServer\Server; +use Http\Server; use Kiri\Abstracts\Config; use Kiri\Abstracts\Config as SConfig; use Kiri\Abstracts\Providers; diff --git a/Server/Abstracts/Http.php b/Server/Abstracts/Http.php index a63ddb10..8274d1f5 100644 --- a/Server/Abstracts/Http.php +++ b/Server/Abstracts/Http.php @@ -3,7 +3,7 @@ namespace Server\Abstracts; use Annotation\Inject; -use HttpServer\Route\Router; +use Http\Route\Router; use Kiri\Abstracts\Config; use Kiri\Exception\ConfigException; use Kiri\Exception\NotFindClassException; diff --git a/Server/Constrict/Request.php b/Server/Constrict/Request.php index e97c6a4e..e64ef735 100644 --- a/Server/Constrict/Request.php +++ b/Server/Constrict/Request.php @@ -2,9 +2,9 @@ namespace Server\Constrict; -use HttpServer\Http\Context; -use HttpServer\Http\Request as HttpResponse; -use HttpServer\Http\Response; +use Http\Http\Context; +use Http\Http\Request as HttpResponse; +use Http\Http\Response; use ReflectionException; use Server\RequestInterface; use Kiri\Exception\NotFindClassException; diff --git a/Server/Constrict/Response.php b/Server/Constrict/Response.php index 89775a6d..d2de7362 100644 --- a/Server/Constrict/Response.php +++ b/Server/Constrict/Response.php @@ -4,8 +4,8 @@ namespace Server\Constrict; -use HttpServer\Http\Context; -use HttpServer\Http\Response as HttpResponse; +use Http\Http\Context; +use Http\Http\Response as HttpResponse; use Server\ResponseInterface; diff --git a/Server/Constrict/ResponseEmitter.php b/Server/Constrict/ResponseEmitter.php index f24986b3..da33ae74 100644 --- a/Server/Constrict/ResponseEmitter.php +++ b/Server/Constrict/ResponseEmitter.php @@ -3,7 +3,7 @@ namespace Server\Constrict; use Exception; -use HttpServer\Http\Formatter\FileFormatter; +use Http\Http\Formatter\FileFormatter; use Kiri\Exception\NotFindClassException; use ReflectionException; use Server\ResponseInterface; diff --git a/Server/Constrict/TcpEmitter.php b/Server/Constrict/TcpEmitter.php index 4de6e0a1..d12d70b6 100644 --- a/Server/Constrict/TcpEmitter.php +++ b/Server/Constrict/TcpEmitter.php @@ -2,7 +2,7 @@ namespace Server\Constrict; -use HttpServer\Http\Formatter\FileFormatter; +use Http\Http\Formatter\FileFormatter; use Kiri\Exception\NotFindClassException; use Server\ResponseInterface; use Swoole\Server; diff --git a/Server/RequestInterface.php b/Server/RequestInterface.php index f4420e61..297ec4fc 100644 --- a/Server/RequestInterface.php +++ b/Server/RequestInterface.php @@ -3,7 +3,7 @@ namespace Server; -use HttpServer\Http\Request; +use Http\Http\Request; /** * diff --git a/Server/ResponseInterface.php b/Server/ResponseInterface.php index aab5bd6e..85a87280 100644 --- a/Server/ResponseInterface.php +++ b/Server/ResponseInterface.php @@ -3,7 +3,7 @@ namespace Server; -use HttpServer\Http\Response; +use Http\Http\Response; /** * @mixin Response diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 86c2a833..f9704a64 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -22,7 +22,7 @@ use Swoole\WebSocket\Server as WServer; /** * Class OnServerManager - * @package HttpServer\Service + * @package Http\Service */ class ServerManager { diff --git a/Server/Service/Http.php b/Server/Service/Http.php index affb9b43..c97f2098 100644 --- a/Server/Service/Http.php +++ b/Server/Service/Http.php @@ -4,8 +4,8 @@ namespace Server\Service; use Exception; -use HttpServer\Exception\RequestException; -use HttpServer\Route\Node; +use Http\Exception\RequestException; +use Http\Route\Node; use Server\Events\OnAfterRequest; use Server\ResponseInterface; use Server\SInterface\OnClose; diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 82cdfb6a..eb4ee934 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -13,13 +13,13 @@ namespace Kiri\Abstracts; use Annotation\Annotation as SAnnotation; use Database\Connection; use Exception; -use HttpServer\Http\HttpHeaders; -use HttpServer\Http\HttpParams; -use HttpServer\Http\Request; -use HttpServer\Http\Response; -use HttpServer\Route\Router; -use HttpServer\Server; -use HttpServer\Shutdown; +use Http\Http\HttpHeaders; +use Http\Http\HttpParams; +use Http\Http\Request; +use Http\Http\Response; +use Http\Route\Router; +use Http\Server; +use Http\Shutdown; use JetBrains\PhpStorm\Pure; use Kafka\KafkaProvider; use Kiri\Aop; diff --git a/System/Abstracts/BaseGoto.php b/System/Abstracts/BaseGoto.php index edabb8cc..22504e31 100644 --- a/System/Abstracts/BaseGoto.php +++ b/System/Abstracts/BaseGoto.php @@ -5,7 +5,7 @@ namespace Kiri\Abstracts; use Exception; -use HttpServer\Exception\ExitException; +use Http\Exception\ExitException; use Kiri\Core\Json; /** diff --git a/System/Abstracts/TraitApplication.php b/System/Abstracts/TraitApplication.php index 7c240f39..542350c4 100644 --- a/System/Abstracts/TraitApplication.php +++ b/System/Abstracts/TraitApplication.php @@ -6,14 +6,14 @@ namespace Kiri\Abstracts; use Annotation\Annotation as SAnnotation; use Database\DatabasesProviders; -use HttpServer\Client\Client; -use HttpServer\Client\Curl; -use HttpServer\Http\Request; -use HttpServer\Http\Response; -use HttpServer\HttpFilter; -use HttpServer\Route\Router; -use HttpServer\Server; -use HttpServer\Shutdown; +use Http\Client\Client; +use Http\Client\Curl; +use Http\Http\Request; +use Http\Http\Response; +use Http\HttpFilter; +use Http\Route\Router; +use Http\Server; +use Http\Shutdown; use Kiri\Crontab\Producer; use Kiri\Async; use Kiri\Cache\Redis; diff --git a/System/Application.php b/System/Application.php index 4e0b0883..9dcf3cac 100644 --- a/System/Application.php +++ b/System/Application.php @@ -15,9 +15,9 @@ use Console\Console; use Console\ConsoleProviders; use Database\DatabasesProviders; use Exception; -use HttpServer\Command; -use HttpServer\Http\Response; -use HttpServer\ServerProviders; +use Http\Command; +use Http\Http\Response; +use Http\ServerProviders; use Kiri\Abstracts\BaseApplication; use Kiri\Abstracts\Config; use Kiri\Abstracts\Input; diff --git a/System/Async.php b/System/Async.php index 053bc3e7..17d0b5f7 100644 --- a/System/Async.php +++ b/System/Async.php @@ -5,7 +5,7 @@ namespace Kiri; use Exception; -use HttpServer\IInterface\Task; +use Http\IInterface\Task; use ReflectionException; use Kiri\Abstracts\Component; use Server\ServerManager; diff --git a/System/Cache/Base/Redis.php b/System/Cache/Base/Redis.php index 41f36b40..710b7628 100644 --- a/System/Cache/Base/Redis.php +++ b/System/Cache/Base/Redis.php @@ -2,7 +2,7 @@ namespace Kiri\Cache\Base; -use HttpServer\Http\Context; +use Http\Http\Context; use Kiri\Events\EventProvider; use Kiri\Exception\RedisConnectException; use Kiri\Kiri; diff --git a/System/Error/ErrorHandler.php b/System/Error/ErrorHandler.php index c936fa2f..1579d3ef 100644 --- a/System/Error/ErrorHandler.php +++ b/System/Error/ErrorHandler.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace Kiri\Error; use Exception; -use HttpServer\IInterface\IFormatter; +use Http\IInterface\IFormatter; use Kiri\Abstracts\Component; use Kiri\Core\Json; use Kiri\Events\EventDispatch; diff --git a/System/Jwt/JWTAuthMiddleware.php b/System/Jwt/JWTAuthMiddleware.php index d2f7f08d..153f27f6 100644 --- a/System/Jwt/JWTAuthMiddleware.php +++ b/System/Jwt/JWTAuthMiddleware.php @@ -7,8 +7,8 @@ namespace Kiri\Jwt; use Closure; use Exception; -use HttpServer\Http\Request; -use HttpServer\IInterface\Middleware; +use Http\Http\Request; +use Http\IInterface\Middleware; use Server\RequestInterface; use Kiri\Kiri; diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 793b02d5..fb9a9315 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -6,7 +6,7 @@ namespace Kiri\Pool; use Closure; use Database\Mysql\PDO; use Exception; -use HttpServer\Http\Context; +use Http\Http\Context; use Kiri\Abstracts\Component; use Kiri\Kiri; use Swoole\Error; diff --git a/System/Pool/Redis.php b/System/Pool/Redis.php index 61f52b85..b63d5aa7 100644 --- a/System/Pool/Redis.php +++ b/System/Pool/Redis.php @@ -7,7 +7,7 @@ namespace Kiri\Pool; use Closure; use Exception; -use HttpServer\Http\Context; +use Http\Http\Context; use Kiri\Abstracts\Component; use Kiri\Exception\ConfigException; use Kiri\Exception\RedisConnectException; diff --git a/composer.json b/composer.json index 255a0ec9..d65c95c7 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "autoload": { "psr-4": { "Kiri\\": "System/", - "HttpServer\\": "HttpServer/", + "Http\\": "http-helper/", "Server\\": "Server/", "Console\\": "Console/", "Gii\\": "Gii/", diff --git a/function.php b/function.php index 64404390..2fb4a074 100644 --- a/function.php +++ b/function.php @@ -4,10 +4,10 @@ defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../')); use Annotation\Annotation; -use HttpServer\Http\Context; -use HttpServer\Http\HttpParams; -use HttpServer\Http\Response as HttpResponse; -use HttpServer\Route\Router; +use Http\Http\Context; +use Http\Http\HttpParams; +use Http\Http\Response as HttpResponse; +use Http\Route\Router; use JetBrains\PhpStorm\Pure; use Kiri\Abstracts\Config; use Kiri\Aop; diff --git a/HttpServer/Abstracts/BaseContext.php b/http-helper/Abstracts/BaseContext.php similarity index 79% rename from HttpServer/Abstracts/BaseContext.php rename to http-helper/Abstracts/BaseContext.php index 5ab45e81..8f922389 100644 --- a/HttpServer/Abstracts/BaseContext.php +++ b/http-helper/Abstracts/BaseContext.php @@ -1,7 +1,7 @@ hash[$className . '::' . $method] ?? []; } - /** - * @param string $className - * @param string $method - * @return bool|Validator - * @throws Exception - */ + /** + * @param array $rules + * @return bool|Validator + * @throws Exception + */ public function check(array $rules): bool|Validator { if (empty($rules)) { diff --git a/HttpServer/IInterface/After.php b/http-helper/IInterface/After.php similarity index 77% rename from HttpServer/IInterface/After.php rename to http-helper/IInterface/After.php index 160a5ccd..a4d4e59a 100644 --- a/HttpServer/IInterface/After.php +++ b/http-helper/IInterface/After.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; use Closure; -use HttpServer\Http\Request; +use Http\Http\Request; interface After { diff --git a/HttpServer/IInterface/AuthIdentity.php b/http-helper/IInterface/AuthIdentity.php similarity index 88% rename from HttpServer/IInterface/AuthIdentity.php rename to http-helper/IInterface/AuthIdentity.php index 2ecb3219..55f75b12 100644 --- a/HttpServer/IInterface/AuthIdentity.php +++ b/http-helper/IInterface/AuthIdentity.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; /** diff --git a/HttpServer/IInterface/IFormatter.php b/http-helper/IInterface/IFormatter.php similarity index 92% rename from HttpServer/IInterface/IFormatter.php rename to http-helper/IInterface/IFormatter.php index 7d3c02a9..12e515b6 100644 --- a/HttpServer/IInterface/IFormatter.php +++ b/http-helper/IInterface/IFormatter.php @@ -7,7 +7,7 @@ declare(strict_types=1); * Time: 17:29 */ -namespace HttpServer\IInterface; +namespace Http\IInterface; /** diff --git a/HttpServer/IInterface/Interceptor.php b/http-helper/IInterface/Interceptor.php similarity index 79% rename from HttpServer/IInterface/Interceptor.php rename to http-helper/IInterface/Interceptor.php index 332c14da..0c916f67 100644 --- a/HttpServer/IInterface/Interceptor.php +++ b/http-helper/IInterface/Interceptor.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; -use HttpServer\Http\Request; +use Http\Http\Request; use Closure; interface Interceptor diff --git a/HttpServer/IInterface/Limits.php b/http-helper/IInterface/Limits.php similarity index 78% rename from HttpServer/IInterface/Limits.php rename to http-helper/IInterface/Limits.php index 7705f433..7eb97ffe 100644 --- a/HttpServer/IInterface/Limits.php +++ b/http-helper/IInterface/Limits.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; -use HttpServer\Http\Request; +use Http\Http\Request; use Closure; interface Limits diff --git a/HttpServer/IInterface/Middleware.php b/http-helper/IInterface/Middleware.php similarity index 82% rename from HttpServer/IInterface/Middleware.php rename to http-helper/IInterface/Middleware.php index e9d5ebb7..02732156 100644 --- a/HttpServer/IInterface/Middleware.php +++ b/http-helper/IInterface/Middleware.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; use Closure; -use HttpServer\Http\Request; +use Http\Http\Request; /** * Interface IMiddleware diff --git a/HttpServer/IInterface/RouterInterface.php b/http-helper/IInterface/RouterInterface.php similarity index 66% rename from HttpServer/IInterface/RouterInterface.php rename to http-helper/IInterface/RouterInterface.php index 584c3094..560d384b 100644 --- a/HttpServer/IInterface/RouterInterface.php +++ b/http-helper/IInterface/RouterInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; interface RouterInterface diff --git a/HttpServer/IInterface/Service.php b/http-helper/IInterface/Service.php similarity index 72% rename from HttpServer/IInterface/Service.php rename to http-helper/IInterface/Service.php index d1e10486..588a9409 100644 --- a/HttpServer/IInterface/Service.php +++ b/http-helper/IInterface/Service.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; interface Service diff --git a/HttpServer/IInterface/Task.php b/http-helper/IInterface/Task.php similarity index 89% rename from HttpServer/IInterface/Task.php rename to http-helper/IInterface/Task.php index bcf665d4..7ca08a67 100644 --- a/HttpServer/IInterface/Task.php +++ b/http-helper/IInterface/Task.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace HttpServer\IInterface; +namespace Http\IInterface; interface Task diff --git a/HttpServer/Route/Any.php b/http-helper/Route/Any.php similarity index 94% rename from HttpServer/Route/Any.php rename to http-helper/Route/Any.php index 8452f4b2..54356ede 100644 --- a/HttpServer/Route/Any.php +++ b/http-helper/Route/Any.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace HttpServer\Route; +namespace Http\Route; /** diff --git a/HttpServer/Route/CoreMiddleware.php b/http-helper/Route/CoreMiddleware.php similarity index 84% rename from HttpServer/Route/CoreMiddleware.php rename to http-helper/Route/CoreMiddleware.php index 8cea4a59..f3396577 100644 --- a/HttpServer/Route/CoreMiddleware.php +++ b/http-helper/Route/CoreMiddleware.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace HttpServer\Route; +namespace Http\Route; use Closure; use Exception; -use HttpServer\Http\Context; -use HttpServer\Http\Request; -use HttpServer\Http\Response; -use HttpServer\IInterface\Middleware; +use Http\Http\Context; +use Http\Http\Request; +use Http\Http\Response; +use Http\IInterface\Middleware; use Server\RequestInterface; use Kiri\Kiri; diff --git a/HttpServer/Route/HandlerProviders.php b/http-helper/Route/HandlerProviders.php similarity index 94% rename from HttpServer/Route/HandlerProviders.php rename to http-helper/Route/HandlerProviders.php index 4e5916f0..37713098 100644 --- a/HttpServer/Route/HandlerProviders.php +++ b/http-helper/Route/HandlerProviders.php @@ -1,6 +1,6 @@ '', + 'Package' => '', + 'Path' => '', + 'Content-Type' => '', + 'Method' => '' +]; +$A_DEFAULT_1 = [ + 'REQUEST tcp/other.protocol v1.0', + 'Source' => '127.0.0.1, 134.43.54.64', + 'Package' => 'qat', + 'Path' => 'getUserDetail', + 'Content-Type' => 'application/json', + 'Method' => 'rpcRequest', + 'Meth21131od' => 'rpcRequest', + 'Met231hod' => 'rpcRequest', + 'Meth1231od' => 'rpcRequest', + 'Meth12312od' => 'rpcRequest', +]; -// -//ini_set('memory_limit', '3096M'); -// -//use Snowflake\Application; -// -//require_once __DIR__ . '/vendor/autoload.php'; -// -//\Swoole\Coroutine\run(function (){ -// $client = HttpServer\Client\Client::NewRequest(); -// $client->setHost('47.92.194.207'); -// $client->setPort(9528); -// $client->setErrorField('code'); -// $client->setErrorMsgField('message'); -// var_dump($client->sendTo('', [],SWOOLE_UDP)); -// -// $client = HttpServer\Client\Client::NewRequest(); -// $client->setHost('47.92.194.207'); -// $client->setPort(9529); -// $client->setErrorField('code'); -// $client->setErrorMsgField('message'); -// var_dump($client->sendTo('', [],SWOOLE_TCP)); -// -// $client = HttpServer\Client\Client::NewRequest(); -// $client->setHost('47.92.194.207'); -// $client->setPort(9529); -// $client->setTimeout(1); -// $client->setUseSwoole(1); -// $client->setErrorField('code'); -// $client->setErrorMsgField('message'); -// var_dump($client->send('', [])); -//}); -//$mail = new \PHPMailer\PHPMailer\PHPMailer(true); - -//try { -// //Server settings -// $mail->SMTPDebug = \PHPMailer\PHPMailer\SMTP::DEBUG_SERVER; // Enable verbose debug output -// $mail->isSMTP(); // Send using SMTP -// $mail->Host = 'smtp1.example.com'; // Set the SMTP server to send through -// $mail->SMTPAuth = true; // Enable SMTP authentication -// $mail->Username = 'user@example.com'; // SMTP username -// $mail->Password = 'secret'; // SMTP password -// $mail->SMTPSecure = \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged -// $mail->Port = 587; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above -// -// //Recipients -// $mail->setFrom('from@example.com', 'Mailer'); -// $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient -// $mail->addAddress('ellen@example.com'); // Name is optional -// $mail->addReplyTo('info@example.com', 'Information'); -// $mail->addCC('cc@example.com'); -// $mail->addBCC('bcc@example.com'); -// -// // Attachments -// $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments -// $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -// -// // Content -// $mail->isHTML(true); // Set email format to HTML -// $mail->Subject = 'Here is the subject'; -// $mail->Body = 'This is the HTML message body in bold!'; -// $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; -// -// $mail->send(); -// echo 'Message has been sent'; -//} catch (Exception $e) { -// echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; -//} - - -//var_dump((bool)null); -//var_dump((bool)0); -//var_dump((bool)1); -//var_dump((bool)false); -//var_dump((bool)true); -//var_dump((bool)"true"); -//var_dump((bool)"false"); -//var_dump((bool)"0"); -//var_dump((bool)"1"); -//var_dump((bool)"健康好几个地方就"); -//var_dump((bool)"lkdjfkgjdflk"); - - -//class Qa -//{ -// public $method = 'aad'; -// -// -// public function clone() -// { -// return new static(); -// } -// -//} -// -// -//$qa = new Qa(); -//var_dump($qa->method); -//$qa->method = 'bbd'; -//var_dump($qa->method); -// -//$new = $qa->clone(); -//var_dump($new); -//$new->method = 'ttd'; -//var_dump($new, $qa); -// - -//$explode = explode('/', '/header////'); -// -//$match = preg_replace_callback('/\d+/', function ($match) { -// return '<*:\d+>'; -//}, '/header/123/3242353/435345435/123123'); -// -//var_dump($match); -// -// -// -//class Arrays extends ArrayIterator -//{ -// -// -// public function __construct($array = array(), $flags = 0) -// { -// parent::__construct($array, $flags); -// } -// -// -// public function current() -// { -// $parent = parent::current(); -// $class = new stdClass(); -// $class->value = $parent; -// $class->key = $this->key(); -// -// return $class; -// } -// -// -// public function next() -// { -// $this->offsetSet($this->key(), new stdClass()); -// -// -// parent::next(); -// } -// -// -//} -// -// -//class ETa implements \IteratorAggregate -//{ -// -// public $array = []; -// -// -// public function getIterator() -// { -// return new Arrays($this->array); -// } -// -// -//} -// -// -//$eta = new ETa(); -//$eta->array = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]; -// -// -//foreach ($eta as $value) { -// var_dump($value); -//} - -//exec('ps -ef 15132 | grep 15132', $output); -//var_dump($output); - -// -//Swoole\Coroutine::create(function () { -// var_dump(\Swoole\Coroutine::getCid()); -//// -//// Swoole\Coroutine::create(function () { -//// var_dump(\Swoole\Coroutine::getPcid()); -//// Swoole\Coroutine::create(function () { -//// var_dump(\Swoole\Coroutine::getPcid()); -//// Swoole\Coroutine::create(function () { -//// var_dump(\Swoole\Coroutine::getPcid()); -//// Swoole\Coroutine::create(function () { -//// var_dump(\Swoole\Coroutine::getPcid()); -//// }); -//// }); -//// }); -//// }); -// Swoole\Coroutine::create(function () { -// var_dump(\Swoole\Coroutine::getPcid()); -// }); -// Swoole\Coroutine::create(function () { -// var_dump(\Swoole\Coroutine::getPcid()); -// }); -// Swoole\Coroutine::create(function () { -// var_dump(\Swoole\Coroutine::getPcid()); -// }); -//}); - - -Swoole\Coroutine::create(function () { - - class b - { - public function et() - { - var_dump(\Swoole\Coroutine::getPcid(), microtime(true)); - \Swoole\Coroutine::sleep(0.01); - } - } - - for ($a = 0; $a < 10; $a++) { - Swoole\Coroutine::create([new b(), 'et']); - } -}); +var_dump(array_diff_key($A_DEFAULT, $A_DEFAULT_1)); diff --git a/socket.html b/socket.html index a966f4be..89450df9 100644 --- a/socket.html +++ b/socket.html @@ -39,13 +39,15 @@ } function connect() { - sock = new WebSocket('ws://47.92.194.207:9530?token=de5cfdf897-e2f-65de-b5686aca2-5575fe&access_token='+encodeURIComponent('ZgHcxCzVuV7kKQsf/j07N5J7BnC1VE5sS32/07utoibiLHLBXLa9htX3LMsik2DY2w0n+MUibQayG0diedcD8g==')+'&iv=iv340f0be2Fx0VvP'); + sock = new WebSocket('ws://47.92.194.207:9528/socket?auth='+encodeURIComponent('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhcHBsaWNhdGlvbjFfNjEwMzc2ZTU2MTRhMTkuNTk0ODM5NzEiLCJpYXQiOjE2Mjc2MTY5OTcsIm5iZiI6MTYyNzYxNjk5NywiZXhwIjoxODg2ODE2OTk3LCJ1aWQiOjUxMCwibmlja25hbWUiOiJvcGVuaWQiLCJqd3Rfc2NlbmUiOiJhcHBsaWNhdGlvbjEifQ.B7zqH0WJklZVN0acER3tmc9S08WoK-aucJ1MghnunuE'), + ['test', 'asdasdkjfgghdfgjdfgdfg12343', 'm-chat']); sock.onopen = function () { if (tick) { clearInterval(tick) } tick = setInterval(function () { sock.send(JSON.stringify({'route': 'getUserPosition', 'tick': new Date().getTime()})); + // sock.close(4000); }, 3000) } } diff --git a/test.php b/test.php index 141f5148..6baef022 100644 --- a/test.php +++ b/test.php @@ -1,6 +1,8 @@ setCallback(function ($body) { //// return $body; //// }); @@ -121,18 +123,49 @@ // unset($class); // } //); +//// +//// // // +//error_reporting(E_ALL); +// +//$a['hello'] = base64_encode(random_bytes(1000)); +//$a['world'] = 'hello'; +//$a['int'] = rand(1, 999999); +//$a['list'] = ['a,', 'b', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx']; +// +//$val = serialize($a); +//$str = pack('N', strlen($val)) . $val . "\r\n"; +// +//var_dump(swoole_substr_unserialize($val, strlen($val))); +// +//var_dump($str, unpack('N', pack('N', strlen($val)))); + +//var_dump( openssl_get_cipher_methods()); +foreach (openssl_get_cipher_methods() as $openssl_get_cipher_method) { + + $iv = ''; + + if (openssl_cipher_iv_length($openssl_get_cipher_method) > 0) { + continue; + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($openssl_get_cipher_method)); + } + + $tag = ''; + + $result = openssl_encrypt(json_encode([ + 'time' => microtime(), + 'scene' => 'application', + 'ot' => 1 + ]), $openssl_get_cipher_method, "xl.zhuangb123.com", 0, $iv, $tag); -error_reporting(E_ALL); + echo $openssl_get_cipher_method . ','; -$a['hello'] = base64_encode(random_bytes(1000)); -$a['world'] = 'hello'; -$a['int'] = rand(1, 999999); -$a['list'] = ['a,', 'b', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx']; +// if ($result != false) { +// echo str_pad($openssl_get_cipher_method, 30, ' ', STR_PAD_RIGHT) . '=> ' . str_replace('=', '', $result) . PHP_EOL; +// echo str_pad($openssl_get_cipher_method, 30, ' ', STR_PAD_RIGHT) . '=> ' . openssl_decrypt(str_replace('=', '', $result), +// $openssl_get_cipher_method, "xl.zhuangb123.com", 0, $iv, $tag) . PHP_EOL; +// } +} -$val = serialize($a); -$str = pack('N', strlen($val)) . $val . "\r\n"; - -var_dump($str, pack('N', strlen($val)));