mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-18 04:43:49 +09:00
Update dependencies
This commit is contained in:
28
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
28
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
@@ -27,13 +27,13 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
class Esi extends AbstractSurrogate
|
||||
{
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'esi';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function addSurrogateControl(Response $response)
|
||||
{
|
||||
@@ -42,10 +42,7 @@ class Esi extends AbstractSurrogate
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = '')
|
||||
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
|
||||
{
|
||||
$html = sprintf('<esi:include src="%s"%s%s />',
|
||||
$uri,
|
||||
@@ -60,10 +57,7 @@ class Esi extends AbstractSurrogate
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(Request $request, Response $response)
|
||||
public function process(Request $request, Response $response): Response
|
||||
{
|
||||
$type = $response->headers->get('Content-Type');
|
||||
if (empty($type)) {
|
||||
@@ -80,8 +74,8 @@ class Esi extends AbstractSurrogate
|
||||
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#s', '', $content);
|
||||
$content = preg_replace('#<esi\:comment[^>]+>#s', '', $content);
|
||||
|
||||
$boundary = self::generateBodyEvalBoundary();
|
||||
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
|
||||
|
||||
$i = 1;
|
||||
while (isset($chunks[$i])) {
|
||||
@@ -95,16 +89,10 @@ class Esi extends AbstractSurrogate
|
||||
throw new \RuntimeException('Unable to process an ESI tag without a "src" attribute.');
|
||||
}
|
||||
|
||||
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, %s, %s) ?>'."\n",
|
||||
var_export($options['src'], true),
|
||||
var_export($options['alt'] ?? '', true),
|
||||
isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false'
|
||||
);
|
||||
++$i;
|
||||
$chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]);
|
||||
++$i;
|
||||
$chunks[$i] = $boundary.$options['src']."\n".($options['alt'] ?? '')."\n".('continue' === ($options['onerror'] ?? ''))."\n";
|
||||
$i += 2;
|
||||
}
|
||||
$content = implode('', $chunks);
|
||||
$content = $boundary.implode('', $chunks).$boundary;
|
||||
|
||||
$response->setContent($content);
|
||||
$response->headers->set('X-Body-Eval', 'ESI');
|
||||
|
||||
Reference in New Issue
Block a user