Skip to content

Commit

Permalink
Delete redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Oct 29, 2024
1 parent 3d9cac7 commit bbff564
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/Protocols/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

namespace Workerman\Protocols;

use Throwable;
use Workerman\Connection\TcpConnection;
use Workerman\Protocols\Http\Request;
use Workerman\Protocols\Http\Response;
use function clearstatcache;
use function count;
use function explode;
use function filesize;
use function fopen;
Expand All @@ -32,7 +30,6 @@
use function ini_get;
use function is_array;
use function is_object;
use function key;
use function preg_match;
use function strlen;
use function strpos;
Expand Down Expand Up @@ -135,23 +132,9 @@ public static function input(string $buffer, TcpConnection $connection): int
*/
public static function decode(string $buffer, TcpConnection $connection): Request
{
static $requests = [];
if (isset($requests[$buffer])) {
$request = clone $requests[$buffer];
$request->connection = $connection;
$connection->request = $request;
$request->properties = [];
return $request;
}
$request = new static::$requestClass($buffer);
$request->connection = $connection;
$connection->request = $request;
if (!isset($buffer[TcpConnection::MAX_CACHE_STRING_LENGTH])) {
$requests[$buffer] = $request;
if (count($requests) > TcpConnection::MAX_CACHE_SIZE) {
unset($requests[key($requests)]);
}
}
return $request;
}

Expand Down

0 comments on commit bbff564

Please sign in to comment.