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

Breadcrumb

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

function Request::preferSafeContent

Checks whether the client browser prefers safe content or not according to RFC8674.

See also

https://tools.ietf.org/html/rfc8674

File

vendor/symfony/http-foundation/Request.php, line 1720

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function preferSafeContent() : bool {
    if (isset($this->isSafeContentPreferred)) {
        return $this->isSafeContentPreferred;
    }
    if (!$this->isSecure()) {
        // see https://tools.ietf.org/html/rfc8674#section-3
        return $this->isSafeContentPreferred = false;
    }
    return $this->isSafeContentPreferred = AcceptHeader::fromString($this->headers
        ->get('Prefer'))
        ->has('safe');
}

API Navigation

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