Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Store.php

function Store::restoreResponse

Restores a Response from the HTTP headers and body.

2 calls to Store::restoreResponse()
Store::invalidate in vendor/symfony/http-kernel/HttpCache/Store.php
Invalidates all cache entries that match the request.
Store::lookup in vendor/symfony/http-kernel/HttpCache/Store.php
Locates a cached Response for the Request provided.

File

vendor/symfony/http-kernel/HttpCache/Store.php, line 467

Class

Store
Store implements all the logic for storing cache metadata (Request and Response headers).

Namespace

Symfony\Component\HttpKernel\HttpCache

Code

private function restoreResponse(array $headers, ?string $path = null) : ?Response {
    $status = $headers['X-Status'][0];
    unset($headers['X-Status']);
    $content = null;
    if (null !== $path) {
        $headers['X-Body-File'] = [
            $path,
        ];
        unset($headers['x-body-file']);
        if ($headers['X-Body-Eval'] ?? $headers['x-body-eval'] ?? false) {
            $content = file_get_contents($path);
            \assert(HttpCache::BODY_EVAL_BOUNDARY_LENGTH === 24);
            if (48 > \strlen($content) || substr($content, -24) !== substr($content, 0, 24)) {
                return null;
            }
        }
    }
    return new Response($content, $status, $headers);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal