__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Aws\Api\Parser;
use GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
use Aws\Api\Parser\Exception\ParserException;
/**
* @inheritDoc
*/
class NonSeekableStreamDecodingEventStreamIterator extends DecodingEventStreamIterator
{
/** @var array $tempBuffer */
private $tempBuffer;
/**
* NonSeekableStreamDecodingEventStreamIterator constructor.
*
* @param StreamInterface $stream
*/
public function __construct(StreamInterface $stream)
{
$this->stream = $stream;
if ($this->stream->isSeekable()) {
throw new \InvalidArgumentException('The stream provided must be not seekable.');
}
$this->tempBuffer = [];
}
/**
* @inheritDoc
*
* @return array
*/
protected function parseEvent(): array
{
$event = [];
$this->hashContext = hash_init('crc32b');
$prelude = $this->parsePrelude()[0];
list(
$event[self::HEADERS],
$numBytes
) = $this->parseHeaders($prelude[self::LENGTH_HEADERS]);
$event[self::PAYLOAD] = Psr7\Utils::streamFor(
$this->readAndHashBytes(
$prelude[self::LENGTH_TOTAL] - self::BYTES_PRELUDE
- $numBytes - self::BYTES_TRAILING
)
);
$calculatedCrc = hash_final($this->hashContext, true);
$messageCrc = $this->stream->read(4);
if ($calculatedCrc !== $messageCrc) {
throw new ParserException('Message checksum mismatch.');
}
return $event;
}
protected function readAndHashBytes($num): string
{
$bytes = '';
while (!empty($this->tempBuffer) && $num > 0) {
$byte = array_shift($this->tempBuffer);
$bytes .= $byte;
$num = $num - 1;
}
$bytes = $bytes . $this->stream->read($num);
hash_update($this->hashContext, $bytes);
return $bytes;
}
// Iterator Functionality
#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentEvent = $this->parseEvent();
}
public function next()
{
$this->tempBuffer[] = $this->stream->read(1);
if ($this->valid()) {
$this->key++;
$this->currentEvent = $this->parseEvent();
}
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
return !$this->stream->eof();
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Exception | Folder | 0777 |
|
|
| AbstractParser.php | File | 1006 B | 0777 |
|
| AbstractRestParser.php | File | 5.49 KB | 0777 |
|
| Crc32ValidatingParser.php | File | 1.48 KB | 0777 |
|
| DecodingEventStreamIterator.php | File | 8.86 KB | 0777 |
|
| EventParsingIterator.php | File | 4.89 KB | 0777 |
|
| JsonParser.php | File | 2.01 KB | 0777 |
|
| JsonRpcParser.php | File | 2.27 KB | 0777 |
|
| MetadataParserTrait.php | File | 2.57 KB | 0777 |
|
| NonSeekableStreamDecodingEventStreamIterator.php | File | 2.43 KB | 0777 |
|
| PayloadParserTrait.php | File | 1.44 KB | 0777 |
|
| QueryParser.php | File | 1.73 KB | 0777 |
|
| RestJsonParser.php | File | 1.22 KB | 0777 |
|
| RestXmlParser.php | File | 1.06 KB | 0777 |
|
| XmlParser.php | File | 5.02 KB | 0777 |
|