cleaned up composer
This commit is contained in:
+14
-3
@@ -41,7 +41,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
/**
|
||||
* Returns a new cache strategy instance.
|
||||
*
|
||||
* @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance
|
||||
* @return ResponseCacheStrategyInterface
|
||||
*/
|
||||
public function createCacheStrategy()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
return false !== strpos($value, sprintf('%s/1.0', strtoupper($this->getName())));
|
||||
return str_contains($value, sprintf('%s/1.0', strtoupper($this->getName())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
try {
|
||||
$response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
|
||||
|
||||
if (!$response->isSuccessful()) {
|
||||
if (!$response->isSuccessful() && Response::HTTP_NOT_MODIFIED !== $response->getStatusCode()) {
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
|
||||
}
|
||||
|
||||
@@ -133,4 +133,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('md5', $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