in src/site/controllers/StaticResourcesController.php [38:76]
public async function getResponseAsync(
ResponseInterface $response,
): Awaitable<ResponseInterface> {
$params = $this->getParameters();
$checksum = $params['Checksum'];
$file = '/'.$params['File'];
$entry = self::invariantTo404(
() ==> StaticResourceMap::getEntryForFile($file),
);
if (
$checksum !== $entry['checksum'] &&
$checksum !== 'local-changes' &&
$checksum !== 'evergreen'
) {
throw new HTTPNotFoundException();
}
await $response->getBody()
->writeAllAsync(\file_get_contents($entry['localPath']));
$response = $response->withHeader('Content-Type', vec[$entry['mimeType']]);
if (
$checksum === 'local-changes' && $this->getParameters()['MTime'] === null
) {
$response = $response->withAddedHeader(
'Cache-Control',
vec['max-age=0, no-cache, no-store'],
);
} else {
$response = $response->withAddedHeader(
'Cache-Control',
vec['max-age=31556926'], // 1 year
)
->withAddedHeader('ETag', vec['"'.$checksum.'"']);
}
return $response;
}