public static function Request::setTrustedHeaderName

Sets the name for trusted headers.

The following header keys are supported:

Setting an empty value allows to disable the trusted header for the given key.

Parameters

string $key The header key:

string $value The header name:

Throws

\InvalidArgumentException

1 call to Request::setTrustedHeaderName()
RequestTest::testTrustedProxies in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 506

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public static function setTrustedHeaderName($key, $value) {
  if (!array_key_exists($key, self::$trustedHeaders)) {
    throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
  }
  self::$trustedHeaders[$key] = $value;
}