mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-17 20:33:54 +09:00
Update dependencies
This commit is contained in:
@@ -24,6 +24,10 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
abstract class AbstractSurrogate implements SurrogateInterface
|
||||
{
|
||||
protected $contentTypes;
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.3
|
||||
*/
|
||||
protected $phpEscapeMap = [
|
||||
['<?', '<%', '<s', '<S'],
|
||||
['<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'],
|
||||
@@ -40,18 +44,13 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
|
||||
/**
|
||||
* Returns a new cache strategy instance.
|
||||
*
|
||||
* @return ResponseCacheStrategyInterface
|
||||
*/
|
||||
public function createCacheStrategy()
|
||||
public function createCacheStrategy(): ResponseCacheStrategyInterface
|
||||
{
|
||||
return new ResponseCacheStrategy();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasSurrogateCapability(Request $request)
|
||||
public function hasSurrogateCapability(Request $request): bool
|
||||
{
|
||||
if (null === $value = $request->headers->get('Surrogate-Capability')) {
|
||||
return false;
|
||||
@@ -61,7 +60,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function addSurrogateCapability(Request $request)
|
||||
{
|
||||
@@ -71,10 +70,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
$request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function needsParsing(Response $response)
|
||||
public function needsParsing(Response $response): bool
|
||||
{
|
||||
if (!$control = $response->headers->get('Surrogate-Control')) {
|
||||
return false;
|
||||
@@ -85,10 +81,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
return (bool) preg_match($pattern, $control);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)
|
||||
public function handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors): string
|
||||
{
|
||||
$subRequest = Request::create($uri, Request::METHOD_GET, [], $cache->getRequest()->cookies->all(), [], $cache->getRequest()->server->all());
|
||||
|
||||
@@ -115,6 +108,8 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
|
||||
/**
|
||||
* Remove the Surrogate from the Surrogate-Control header.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function removeFromControl(Response $response)
|
||||
{
|
||||
@@ -133,4 +128,15 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
|
||||
}
|
||||
}
|
||||
|
||||
protected static function generateBodyEvalBoundary(): string
|
||||
{
|
||||
static $cookie;
|
||||
$cookie = hash('xxh128', $cookie ?? $cookie = random_bytes(16), true);
|
||||
$boundary = base64_encode($cookie);
|
||||
|
||||
\assert(HttpCache::BODY_EVAL_BOUNDARY_LENGTH === \strlen($boundary));
|
||||
|
||||
return $boundary;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user