mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-17 04:13:46 +09:00
Update dependencies
This commit is contained in:
30
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
30
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
@@ -21,16 +21,13 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
class Ssi extends AbstractSurrogate
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'ssi';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function addSurrogateControl(Response $response)
|
||||
{
|
||||
@@ -39,18 +36,12 @@ class Ssi 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
|
||||
{
|
||||
return sprintf('<!--#include virtual="%s" -->', $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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)) {
|
||||
@@ -64,9 +55,8 @@ class Ssi extends AbstractSurrogate
|
||||
|
||||
// we don't use a proper XML parser here as we can have SSI tags in a plain text response
|
||||
$content = $response->getContent();
|
||||
|
||||
$boundary = self::generateBodyEvalBoundary();
|
||||
$chunks = preg_split('#<!--\#include\s+(.*?)\s*-->#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
|
||||
|
||||
$i = 1;
|
||||
while (isset($chunks[$i])) {
|
||||
@@ -80,14 +70,10 @@ class Ssi extends AbstractSurrogate
|
||||
throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.');
|
||||
}
|
||||
|
||||
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, \'\', false) ?>'."\n",
|
||||
var_export($options['virtual'], true)
|
||||
);
|
||||
++$i;
|
||||
$chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]);
|
||||
++$i;
|
||||
$chunks[$i] = $boundary.$options['virtual']."\n\n\n";
|
||||
$i += 2;
|
||||
}
|
||||
$content = implode('', $chunks);
|
||||
$content = $boundary.implode('', $chunks).$boundary;
|
||||
|
||||
$response->setContent($content);
|
||||
$response->headers->set('X-Body-Eval', 'SSI');
|
||||
|
||||
Reference in New Issue
Block a user