mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-22 11:09:11 -04:00
ALPHA 3.0.2a
This commit is contained in:
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
@@ -71,7 +71,7 @@ class Esi extends AbstractSurrogate
|
||||
}
|
||||
|
||||
$parts = explode(';', $type);
|
||||
if (!in_array($parts[0], $this->contentTypes)) {
|
||||
if (!\in_array($parts[0], $this->contentTypes)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\HttpCache;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
|
||||
/**
|
||||
* Cache provides HTTP caching.
|
||||
@@ -370,7 +370,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
// return the response and not the cache entry if the response is valid but not cached
|
||||
$etag = $response->getEtag();
|
||||
if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) {
|
||||
if ($etag && \in_array($etag, $requestEtags) && !\in_array($etag, $cachedEtags)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -444,30 +444,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$this->surrogate->addSurrogateCapability($request);
|
||||
}
|
||||
|
||||
// modify the X-Forwarded-For header if needed
|
||||
$forwardedFor = $request->headers->get('X-Forwarded-For');
|
||||
if ($forwardedFor) {
|
||||
$request->headers->set('X-Forwarded-For', $forwardedFor.', '.$request->server->get('REMOTE_ADDR'));
|
||||
} else {
|
||||
$request->headers->set('X-Forwarded-For', $request->server->get('REMOTE_ADDR'));
|
||||
}
|
||||
|
||||
// fix the client IP address by setting it to 127.0.0.1 as HttpCache
|
||||
// is always called from the same process as the backend.
|
||||
$request->server->set('REMOTE_ADDR', '127.0.0.1');
|
||||
|
||||
// make sure HttpCache is a trusted proxy
|
||||
if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) {
|
||||
$trustedProxies[] = '127.0.0.1';
|
||||
Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL);
|
||||
}
|
||||
|
||||
// always a "master" request (as the real master request can be in cache)
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch);
|
||||
// FIXME: we probably need to also catch exceptions if raw === true
|
||||
$response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch);
|
||||
|
||||
// we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC
|
||||
if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) {
|
||||
if (null !== $entry && \in_array($response->getStatusCode(), array(500, 502, 503, 504))) {
|
||||
if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) {
|
||||
$age = $this->options['stale_if_error'];
|
||||
}
|
||||
@@ -606,7 +587,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$response->setContent(ob_get_clean());
|
||||
$response->headers->remove('X-Body-Eval');
|
||||
if (!$response->headers->has('Transfer-Encoding')) {
|
||||
$response->headers->set('Content-Length', strlen($response->getContent()));
|
||||
$response->headers->set('Content-Length', \strlen($response->getContent()));
|
||||
}
|
||||
} elseif ($response->headers->has('X-Body-File')) {
|
||||
// Response does not include possibly dynamic content (ESI, SSI), so we need
|
||||
@@ -640,7 +621,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$key = strtolower(str_replace('HTTP_', '', $key));
|
||||
|
||||
if ('cookie' === $key) {
|
||||
if (count($request->cookies->all())) {
|
||||
if (\count($request->cookies->all())) {
|
||||
return true;
|
||||
}
|
||||
} elseif ($request->headers->has($key)) {
|
||||
|
||||
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
@@ -58,7 +58,7 @@ class Ssi extends AbstractSurrogate
|
||||
}
|
||||
|
||||
$parts = explode(';', $type);
|
||||
if (!in_array($parts[0], $this->contentTypes)) {
|
||||
if (!\in_array($parts[0], $this->contentTypes)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
12
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
12
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
@@ -66,7 +66,7 @@ class Store implements StoreInterface
|
||||
|
||||
if (!isset($this->locks[$key])) {
|
||||
$path = $this->getPath($key);
|
||||
if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
|
||||
return $path;
|
||||
}
|
||||
$h = fopen($path, 'cb');
|
||||
@@ -185,7 +185,7 @@ class Store implements StoreInterface
|
||||
$response->headers->set('X-Content-Digest', $digest);
|
||||
|
||||
if (!$response->headers->has('Transfer-Encoding')) {
|
||||
$response->headers->set('Content-Length', strlen($response->getContent()));
|
||||
$response->headers->set('Content-Length', \strlen($response->getContent()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,17 +373,17 @@ class Store implements StoreInterface
|
||||
@ftruncate($fp, 0);
|
||||
@fseek($fp, 0);
|
||||
$len = @fwrite($fp, $data);
|
||||
if (strlen($data) !== $len) {
|
||||
if (\strlen($data) !== $len) {
|
||||
@ftruncate($fp, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmpFile = tempnam(dirname($path), basename($path));
|
||||
$tmpFile = tempnam(\dirname($path), basename($path));
|
||||
if (false === $fp = @fopen($tmpFile, 'wb')) {
|
||||
@unlink($tmpFile);
|
||||
|
||||
@@ -410,7 +410,7 @@ class Store implements StoreInterface
|
||||
|
||||
public function getPath($key)
|
||||
{
|
||||
return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
return $this->root.\DIRECTORY_SEPARATOR.substr($key, 0, 2).\DIRECTORY_SEPARATOR.substr($key, 2, 2).\DIRECTORY_SEPARATOR.substr($key, 4, 2).\DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user