1254 lines
37 KiB
YAML
1254 lines
37 KiB
YAML
name: Request
|
|
class_comment: '# * Request represents an HTTP request.
|
|
|
|
# *
|
|
|
|
# * The methods dealing with URL accept / return a raw path (% encoded):
|
|
|
|
# * * getBasePath
|
|
|
|
# * * getBaseUrl
|
|
|
|
# * * getPathInfo
|
|
|
|
# * * getRequestUri
|
|
|
|
# * * getUri
|
|
|
|
# * * getUriForPath
|
|
|
|
# *
|
|
|
|
# * @author Fabien Potencier <fabien@symfony.com>'
|
|
dependencies:
|
|
- name: ConflictingHeadersException
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
|
|
- name: JsonException
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Exception\JsonException
|
|
- name: SessionNotFoundException
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Exception\SessionNotFoundException
|
|
- name: SuspiciousOperationException
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException
|
|
- name: SessionInterface
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Session\SessionInterface
|
|
properties:
|
|
- name: content
|
|
visibility: protected
|
|
comment: "# * Request represents an HTTP request.\n# *\n# * The methods dealing\
|
|
\ with URL accept / return a raw path (% encoded):\n# * * getBasePath\n# * \
|
|
\ * getBaseUrl\n# * * getPathInfo\n# * * getRequestUri\n# * * getUri\n\
|
|
# * * getUriForPath\n# *\n# * @author Fabien Potencier <fabien@symfony.com>\n\
|
|
# */\n# class Request\n# {\n# public const HEADER_FORWARDED = 0b000001; // When\
|
|
\ using RFC 7239\n# public const HEADER_X_FORWARDED_FOR = 0b000010;\n# public\
|
|
\ const HEADER_X_FORWARDED_HOST = 0b000100;\n# public const HEADER_X_FORWARDED_PROTO\
|
|
\ = 0b001000;\n# public const HEADER_X_FORWARDED_PORT = 0b010000;\n# public const\
|
|
\ HEADER_X_FORWARDED_PREFIX = 0b100000;\n# \n# public const HEADER_X_FORWARDED_AWS_ELB\
|
|
\ = 0b0011010; // AWS ELB doesn't send X-Forwarded-Host\n# public const HEADER_X_FORWARDED_TRAEFIK\
|
|
\ = 0b0111110; // All \"X-Forwarded-*\" headers sent by Traefik reverse proxy\n\
|
|
# \n# public const METHOD_HEAD = 'HEAD';\n# public const METHOD_GET = 'GET';\n\
|
|
# public const METHOD_POST = 'POST';\n# public const METHOD_PUT = 'PUT';\n# public\
|
|
\ const METHOD_PATCH = 'PATCH';\n# public const METHOD_DELETE = 'DELETE';\n# public\
|
|
\ const METHOD_PURGE = 'PURGE';\n# public const METHOD_OPTIONS = 'OPTIONS';\n\
|
|
# public const METHOD_TRACE = 'TRACE';\n# public const METHOD_CONNECT = 'CONNECT';\n\
|
|
# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedProxies =\
|
|
\ [];\n# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedHostPatterns\
|
|
\ = [];\n# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedHosts\
|
|
\ = [];\n# \n# protected static bool $httpMethodParameterOverride = false;\n#\
|
|
\ \n# /**\n# * Custom parameters.\n# */\n# public ParameterBag $attributes;\n\
|
|
# \n# /**\n# * Request body parameters ($_POST).\n# *\n# * @see getPayload() for\
|
|
\ portability between content types\n# */\n# public InputBag $request;\n# \n#\
|
|
\ /**\n# * Query string parameters ($_GET).\n# */\n# public InputBag $query;\n\
|
|
# \n# /**\n# * Server and execution environment parameters ($_SERVER).\n# */\n\
|
|
# public ServerBag $server;\n# \n# /**\n# * Uploaded files ($_FILES).\n# */\n\
|
|
# public FileBag $files;\n# \n# /**\n# * Cookies ($_COOKIE).\n# */\n# public InputBag\
|
|
\ $cookies;\n# \n# /**\n# * Headers (taken from the $_SERVER).\n# */\n# public\
|
|
\ HeaderBag $headers;\n# \n# /**\n# * @var string|resource|false|null"
|
|
- name: isIisRewrite
|
|
visibility: private
|
|
comment: "# * @var string[]|null\n# */\n# protected ?array $languages = null;\n\
|
|
# \n# /**\n# * @var string[]|null\n# */\n# protected ?array $charsets = null;\n\
|
|
# \n# /**\n# * @var string[]|null\n# */\n# protected ?array $encodings = null;\n\
|
|
# \n# /**\n# * @var string[]|null\n# */\n# protected ?array $acceptableContentTypes\
|
|
\ = null;\n# \n# protected ?string $pathInfo = null;\n# protected ?string $requestUri\
|
|
\ = null;\n# protected ?string $baseUrl = null;\n# protected ?string $basePath\
|
|
\ = null;\n# protected ?string $method = null;\n# protected ?string $format =\
|
|
\ null;\n# protected SessionInterface|\\Closure|null $session = null;\n# protected\
|
|
\ ?string $locale = null;\n# protected string $defaultLocale = 'en';\n# \n# /**\n\
|
|
# * @var array<string, string[]>|null\n# */\n# protected static ?array $formats\
|
|
\ = null;\n# \n# protected static ?\\Closure $requestFactory = null;\n# \n# private\
|
|
\ ?string $preferredFormat = null;\n# \n# private bool $isHostValid = true;\n\
|
|
# private bool $isForwardedValid = true;\n# private bool $isSafeContentPreferred;\n\
|
|
# \n# private array $trustedValuesCache = [];\n# \n# private static int $trustedHeaderSet\
|
|
\ = -1;\n# \n# private const FORWARDED_PARAMS = [\n# self::HEADER_X_FORWARDED_FOR\
|
|
\ => 'for',\n# self::HEADER_X_FORWARDED_HOST => 'host',\n# self::HEADER_X_FORWARDED_PROTO\
|
|
\ => 'proto',\n# self::HEADER_X_FORWARDED_PORT => 'host',\n# ];\n# \n# /**\n#\
|
|
\ * Names for headers that can be trusted when\n# * using trusted proxies.\n#\
|
|
\ *\n# * The FORWARDED header is the standard as of rfc7239.\n# *\n# * The other\
|
|
\ headers are non-standard, but widely used\n# * by popular reverse proxies (like\
|
|
\ Apache mod_proxy or Amazon EC2).\n# */\n# private const TRUSTED_HEADERS = [\n\
|
|
# self::HEADER_FORWARDED => 'FORWARDED',\n# self::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',\n\
|
|
# self::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',\n# self::HEADER_X_FORWARDED_PROTO\
|
|
\ => 'X_FORWARDED_PROTO',\n# self::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',\n\
|
|
# self::HEADER_X_FORWARDED_PREFIX => 'X_FORWARDED_PREFIX',\n# ];\n# \n# /** @var\
|
|
\ bool"
|
|
methods:
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: query
|
|
default: '[]'
|
|
- name: request
|
|
default: '[]'
|
|
- name: attributes
|
|
default: '[]'
|
|
- name: cookies
|
|
default: '[]'
|
|
- name: files
|
|
default: '[]'
|
|
- name: server
|
|
default: '[]'
|
|
- name: content
|
|
default: 'null'
|
|
comment: "# * Request represents an HTTP request.\n# *\n# * The methods dealing\
|
|
\ with URL accept / return a raw path (% encoded):\n# * * getBasePath\n# * \
|
|
\ * getBaseUrl\n# * * getPathInfo\n# * * getRequestUri\n# * * getUri\n\
|
|
# * * getUriForPath\n# *\n# * @author Fabien Potencier <fabien@symfony.com>\n\
|
|
# */\n# class Request\n# {\n# public const HEADER_FORWARDED = 0b000001; // When\
|
|
\ using RFC 7239\n# public const HEADER_X_FORWARDED_FOR = 0b000010;\n# public\
|
|
\ const HEADER_X_FORWARDED_HOST = 0b000100;\n# public const HEADER_X_FORWARDED_PROTO\
|
|
\ = 0b001000;\n# public const HEADER_X_FORWARDED_PORT = 0b010000;\n# public const\
|
|
\ HEADER_X_FORWARDED_PREFIX = 0b100000;\n# \n# public const HEADER_X_FORWARDED_AWS_ELB\
|
|
\ = 0b0011010; // AWS ELB doesn't send X-Forwarded-Host\n# public const HEADER_X_FORWARDED_TRAEFIK\
|
|
\ = 0b0111110; // All \"X-Forwarded-*\" headers sent by Traefik reverse proxy\n\
|
|
# \n# public const METHOD_HEAD = 'HEAD';\n# public const METHOD_GET = 'GET';\n\
|
|
# public const METHOD_POST = 'POST';\n# public const METHOD_PUT = 'PUT';\n# public\
|
|
\ const METHOD_PATCH = 'PATCH';\n# public const METHOD_DELETE = 'DELETE';\n# public\
|
|
\ const METHOD_PURGE = 'PURGE';\n# public const METHOD_OPTIONS = 'OPTIONS';\n\
|
|
# public const METHOD_TRACE = 'TRACE';\n# public const METHOD_CONNECT = 'CONNECT';\n\
|
|
# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedProxies =\
|
|
\ [];\n# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedHostPatterns\
|
|
\ = [];\n# \n# /**\n# * @var string[]\n# */\n# protected static array $trustedHosts\
|
|
\ = [];\n# \n# protected static bool $httpMethodParameterOverride = false;\n#\
|
|
\ \n# /**\n# * Custom parameters.\n# */\n# public ParameterBag $attributes;\n\
|
|
# \n# /**\n# * Request body parameters ($_POST).\n# *\n# * @see getPayload() for\
|
|
\ portability between content types\n# */\n# public InputBag $request;\n# \n#\
|
|
\ /**\n# * Query string parameters ($_GET).\n# */\n# public InputBag $query;\n\
|
|
# \n# /**\n# * Server and execution environment parameters ($_SERVER).\n# */\n\
|
|
# public ServerBag $server;\n# \n# /**\n# * Uploaded files ($_FILES).\n# */\n\
|
|
# public FileBag $files;\n# \n# /**\n# * Cookies ($_COOKIE).\n# */\n# public InputBag\
|
|
\ $cookies;\n# \n# /**\n# * Headers (taken from the $_SERVER).\n# */\n# public\
|
|
\ HeaderBag $headers;\n# \n# /**\n# * @var string|resource|false|null\n# */\n\
|
|
# protected $content;\n# \n# /**\n# * @var string[]|null\n# */\n# protected ?array\
|
|
\ $languages = null;\n# \n# /**\n# * @var string[]|null\n# */\n# protected ?array\
|
|
\ $charsets = null;\n# \n# /**\n# * @var string[]|null\n# */\n# protected ?array\
|
|
\ $encodings = null;\n# \n# /**\n# * @var string[]|null\n# */\n# protected ?array\
|
|
\ $acceptableContentTypes = null;\n# \n# protected ?string $pathInfo = null;\n\
|
|
# protected ?string $requestUri = null;\n# protected ?string $baseUrl = null;\n\
|
|
# protected ?string $basePath = null;\n# protected ?string $method = null;\n#\
|
|
\ protected ?string $format = null;\n# protected SessionInterface|\\Closure|null\
|
|
\ $session = null;\n# protected ?string $locale = null;\n# protected string $defaultLocale\
|
|
\ = 'en';\n# \n# /**\n# * @var array<string, string[]>|null\n# */\n# protected\
|
|
\ static ?array $formats = null;\n# \n# protected static ?\\Closure $requestFactory\
|
|
\ = null;\n# \n# private ?string $preferredFormat = null;\n# \n# private bool\
|
|
\ $isHostValid = true;\n# private bool $isForwardedValid = true;\n# private bool\
|
|
\ $isSafeContentPreferred;\n# \n# private array $trustedValuesCache = [];\n# \n\
|
|
# private static int $trustedHeaderSet = -1;\n# \n# private const FORWARDED_PARAMS\
|
|
\ = [\n# self::HEADER_X_FORWARDED_FOR => 'for',\n# self::HEADER_X_FORWARDED_HOST\
|
|
\ => 'host',\n# self::HEADER_X_FORWARDED_PROTO => 'proto',\n# self::HEADER_X_FORWARDED_PORT\
|
|
\ => 'host',\n# ];\n# \n# /**\n# * Names for headers that can be trusted when\n\
|
|
# * using trusted proxies.\n# *\n# * The FORWARDED header is the standard as of\
|
|
\ rfc7239.\n# *\n# * The other headers are non-standard, but widely used\n# *\
|
|
\ by popular reverse proxies (like Apache mod_proxy or Amazon EC2).\n# */\n# private\
|
|
\ const TRUSTED_HEADERS = [\n# self::HEADER_FORWARDED => 'FORWARDED',\n# self::HEADER_X_FORWARDED_FOR\
|
|
\ => 'X_FORWARDED_FOR',\n# self::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',\n\
|
|
# self::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',\n# self::HEADER_X_FORWARDED_PORT\
|
|
\ => 'X_FORWARDED_PORT',\n# self::HEADER_X_FORWARDED_PREFIX => 'X_FORWARDED_PREFIX',\n\
|
|
# ];\n# \n# /** @var bool */\n# private $isIisRewrite = false;\n# \n# /**\n# *\
|
|
\ @param array $query The GET parameters\n# * @param array\
|
|
\ $request The POST parameters\n# * @param array \
|
|
\ $attributes The request attributes (parameters parsed from the PATH_INFO,\
|
|
\ ...)\n# * @param array $cookies The COOKIE parameters\n# *\
|
|
\ @param array $files The FILES parameters\n# * @param array\
|
|
\ $server The SERVER parameters\n# * @param string|resource|null\
|
|
\ $content The raw body data"
|
|
- name: initialize
|
|
visibility: public
|
|
parameters:
|
|
- name: query
|
|
default: '[]'
|
|
- name: request
|
|
default: '[]'
|
|
- name: attributes
|
|
default: '[]'
|
|
- name: cookies
|
|
default: '[]'
|
|
- name: files
|
|
default: '[]'
|
|
- name: server
|
|
default: '[]'
|
|
- name: content
|
|
default: 'null'
|
|
comment: '# * Sets the parameters for this request.
|
|
|
|
# *
|
|
|
|
# * This method also re-initializes all properties.
|
|
|
|
# *
|
|
|
|
# * @param array $query The GET parameters
|
|
|
|
# * @param array $request The POST parameters
|
|
|
|
# * @param array $attributes The request attributes (parameters
|
|
parsed from the PATH_INFO, ...)
|
|
|
|
# * @param array $cookies The COOKIE parameters
|
|
|
|
# * @param array $files The FILES parameters
|
|
|
|
# * @param array $server The SERVER parameters
|
|
|
|
# * @param string|resource|null $content The raw body data'
|
|
- name: createFromGlobals
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Creates a new request with values from PHP''s super globals.'
|
|
- name: create
|
|
visibility: public
|
|
parameters:
|
|
- name: uri
|
|
- name: method
|
|
default: '''GET'''
|
|
- name: parameters
|
|
default: '[]'
|
|
- name: cookies
|
|
default: '[]'
|
|
- name: files
|
|
default: '[]'
|
|
- name: server
|
|
default: '[]'
|
|
- name: content
|
|
default: 'null'
|
|
comment: '# * Creates a Request based on a given URI and configuration.
|
|
|
|
# *
|
|
|
|
# * The information contained in the URI always take precedence
|
|
|
|
# * over the other information (server and parameters).
|
|
|
|
# *
|
|
|
|
# * @param string $uri The URI
|
|
|
|
# * @param string $method The HTTP method
|
|
|
|
# * @param array $parameters The query (GET) or request (POST)
|
|
parameters
|
|
|
|
# * @param array $cookies The request cookies ($_COOKIE)
|
|
|
|
# * @param array $files The request files ($_FILES)
|
|
|
|
# * @param array $server The server parameters ($_SERVER)
|
|
|
|
# * @param string|resource|null $content The raw body data'
|
|
- name: setFactory
|
|
visibility: public
|
|
parameters:
|
|
- name: callable
|
|
comment: '# * Sets a callable able to create a Request instance.
|
|
|
|
# *
|
|
|
|
# * This is mainly useful when you need to override the Request class
|
|
|
|
# * to keep BC with an existing system. It should not be used for any
|
|
|
|
# * other purpose.'
|
|
- name: duplicate
|
|
visibility: public
|
|
parameters:
|
|
- name: query
|
|
default: 'null'
|
|
- name: request
|
|
default: 'null'
|
|
- name: attributes
|
|
default: 'null'
|
|
- name: cookies
|
|
default: 'null'
|
|
- name: files
|
|
default: 'null'
|
|
- name: server
|
|
default: 'null'
|
|
comment: '# * Clones a request and overrides some of its parameters.
|
|
|
|
# *
|
|
|
|
# * @param array|null $query The GET parameters
|
|
|
|
# * @param array|null $request The POST parameters
|
|
|
|
# * @param array|null $attributes The request attributes (parameters parsed from
|
|
the PATH_INFO, ...)
|
|
|
|
# * @param array|null $cookies The COOKIE parameters
|
|
|
|
# * @param array|null $files The FILES parameters
|
|
|
|
# * @param array|null $server The SERVER parameters'
|
|
- name: __clone
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Clones the current request.
|
|
|
|
# *
|
|
|
|
# * Note that the session is not cloned as duplicated requests
|
|
|
|
# * are most of the time sub-requests of the main one.'
|
|
- name: __toString
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: overrideGlobals
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Overrides the PHP global variables according to this request instance.
|
|
|
|
# *
|
|
|
|
# * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE.
|
|
|
|
# * $_FILES is never overridden, see rfc1867'
|
|
- name: setTrustedProxies
|
|
visibility: public
|
|
parameters:
|
|
- name: proxies
|
|
- name: trustedHeaderSet
|
|
comment: '# * Sets a list of trusted proxies.
|
|
|
|
# *
|
|
|
|
# * You should only list the reverse proxies that you manage directly.
|
|
|
|
# *
|
|
|
|
# * @param array $proxies A list of trusted proxies, the string ''REMOTE_ADDR''
|
|
will be replaced with $_SERVER[''REMOTE_ADDR'']
|
|
|
|
# * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which
|
|
headers to trust from your proxies'
|
|
- name: getTrustedProxies
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the list of trusted proxies.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: getTrustedHeaderSet
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the set of trusted headers from trusted proxies.
|
|
|
|
# *
|
|
|
|
# * @return int A bit field of Request::HEADER_* that defines which headers are
|
|
trusted from your proxies'
|
|
- name: setTrustedHosts
|
|
visibility: public
|
|
parameters:
|
|
- name: hostPatterns
|
|
comment: '# * Sets a list of trusted host patterns.
|
|
|
|
# *
|
|
|
|
# * You should only list the hosts you manage using regexs.
|
|
|
|
# *
|
|
|
|
# * @param array $hostPatterns A list of trusted host patterns'
|
|
- name: getTrustedHosts
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the list of trusted host patterns.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: normalizeQueryString
|
|
visibility: public
|
|
parameters:
|
|
- name: qs
|
|
comment: '# * Normalizes a query string.
|
|
|
|
# *
|
|
|
|
# * It builds a normalized query string, where keys/value pairs are alphabetized,
|
|
|
|
# * have consistent escaping and unneeded delimiters are removed.'
|
|
- name: enableHttpMethodParameterOverride
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Enables support for the _method request parameter to determine the
|
|
intended HTTP method.
|
|
|
|
# *
|
|
|
|
# * Be warned that enabling this feature might lead to CSRF issues in your code.
|
|
|
|
# * Check that you are using CSRF tokens when required.
|
|
|
|
# * If the HTTP method parameter override is enabled, an html-form with method
|
|
"POST" can be altered
|
|
|
|
# * and used to send a "PUT" or "DELETE" request via the _method request parameter.
|
|
|
|
# * If these methods are not protected against CSRF, this presents a possible
|
|
vulnerability.
|
|
|
|
# *
|
|
|
|
# * The HTTP method can only be overridden when the real HTTP method is POST.'
|
|
- name: getHttpMethodParameterOverride
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether support for the _method request parameter is enabled.'
|
|
- name: get
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Gets a "parameter" value from any bag.
|
|
|
|
# *
|
|
|
|
# * This method is mainly useful for libraries that want to provide some flexibility.
|
|
If you don''t need the
|
|
|
|
# * flexibility in controllers, it is better to explicitly get request parameters
|
|
from the appropriate
|
|
|
|
# * public property instead (attributes, query, request).
|
|
|
|
# *
|
|
|
|
# * Order of precedence: PATH (routing placeholders or custom attributes), GET,
|
|
POST
|
|
|
|
# *
|
|
|
|
# * @internal use explicit input sources instead'
|
|
- name: getSession
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the Session.
|
|
|
|
# *
|
|
|
|
# * @throws SessionNotFoundException When session is not set properly'
|
|
- name: hasPreviousSession
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Whether the request contains a Session which was started in one of
|
|
the
|
|
|
|
# * previous requests.'
|
|
- name: hasSession
|
|
visibility: public
|
|
parameters:
|
|
- name: skipIfUninitialized
|
|
default: 'false'
|
|
comment: '# * Whether the request contains a Session object.
|
|
|
|
# *
|
|
|
|
# * This method does not give any information about the state of the session object,
|
|
|
|
# * like whether the session is started or not. It is just a way to check if this
|
|
Request
|
|
|
|
# * is associated with a Session instance.
|
|
|
|
# *
|
|
|
|
# * @param bool $skipIfUninitialized When true, ignores factories injected by
|
|
`setSessionFactory`'
|
|
- name: setSession
|
|
visibility: public
|
|
parameters:
|
|
- name: session
|
|
comment: null
|
|
- name: setSessionFactory
|
|
visibility: public
|
|
parameters:
|
|
- name: factory
|
|
comment: '# * @internal
|
|
|
|
# *
|
|
|
|
# * @param callable(): SessionInterface $factory'
|
|
- name: getClientIps
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the client IP addresses.
|
|
|
|
# *
|
|
|
|
# * In the returned array the most trusted IP address is first, and the
|
|
|
|
# * least trusted one last. The "real" client IP address is the last one,
|
|
|
|
# * but this is also the least trusted one. Trusted proxies are stripped.
|
|
|
|
# *
|
|
|
|
# * Use this method carefully; you should use getClientIp() instead.
|
|
|
|
# *
|
|
|
|
# * @see getClientIp()'
|
|
- name: getClientIp
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the client IP address.
|
|
|
|
# *
|
|
|
|
# * This method can read the client IP address from the "X-Forwarded-For" header
|
|
|
|
# * when trusted proxies were set via "setTrustedProxies()". The "X-Forwarded-For"
|
|
|
|
# * header value is a comma+space separated list of IP addresses, the left-most
|
|
|
|
# * being the original client, and each successive proxy that passed the request
|
|
|
|
# * adding the IP address where it received the request from.
|
|
|
|
# *
|
|
|
|
# * If your reverse proxy uses a different header name than "X-Forwarded-For",
|
|
|
|
# * ("Client-Ip" for instance), configure it via the $trustedHeaderSet
|
|
|
|
# * argument of the Request::setTrustedProxies() method instead.
|
|
|
|
# *
|
|
|
|
# * @see getClientIps()
|
|
|
|
# * @see https://wikipedia.org/wiki/X-Forwarded-For'
|
|
- name: getScriptName
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns current script name.'
|
|
- name: getPathInfo
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the path being requested relative to the executed script.
|
|
|
|
# *
|
|
|
|
# * The path info always starts with a /.
|
|
|
|
# *
|
|
|
|
# * Suppose this request is instantiated from /mysite on localhost:
|
|
|
|
# *
|
|
|
|
# * * http://localhost/mysite returns an empty string
|
|
|
|
# * * http://localhost/mysite/about returns ''/about''
|
|
|
|
# * * http://localhost/mysite/enco%20ded returns ''/enco%20ded''
|
|
|
|
# * * http://localhost/mysite/about?var=1 returns ''/about''
|
|
|
|
# *
|
|
|
|
# * @return string The raw path (i.e. not urldecoded)'
|
|
- name: getBasePath
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the root path from which this request is executed.
|
|
|
|
# *
|
|
|
|
# * Suppose that an index.php file instantiates this request object:
|
|
|
|
# *
|
|
|
|
# * * http://localhost/index.php returns an empty string
|
|
|
|
# * * http://localhost/index.php/page returns an empty string
|
|
|
|
# * * http://localhost/web/index.php returns ''/web''
|
|
|
|
# * * http://localhost/we%20b/index.php returns ''/we%20b''
|
|
|
|
# *
|
|
|
|
# * @return string The raw path (i.e. not urldecoded)'
|
|
- name: getBaseUrl
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the root URL from which this request is executed.
|
|
|
|
# *
|
|
|
|
# * The base URL never ends with a /.
|
|
|
|
# *
|
|
|
|
# * This is similar to getBasePath(), except that it also includes the
|
|
|
|
# * script filename (e.g. index.php) if one exists.
|
|
|
|
# *
|
|
|
|
# * @return string The raw URL (i.e. not urldecoded)'
|
|
- name: getBaseUrlReal
|
|
visibility: private
|
|
parameters: []
|
|
comment: '# * Returns the real base URL received by the webserver from which this
|
|
request is executed.
|
|
|
|
# * The URL does not include trusted reverse proxy prefix.
|
|
|
|
# *
|
|
|
|
# * @return string The raw URL (i.e. not urldecoded)'
|
|
- name: getScheme
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the request''s scheme.'
|
|
- name: getPort
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the port on which the request is made.
|
|
|
|
# *
|
|
|
|
# * This method can read the client port from the "X-Forwarded-Port" header
|
|
|
|
# * when trusted proxies were set via "setTrustedProxies()".
|
|
|
|
# *
|
|
|
|
# * The "X-Forwarded-Port" header must contain the client port.
|
|
|
|
# *
|
|
|
|
# * @return int|string|null Can be a string if fetched from the server bag'
|
|
- name: getUser
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the user.'
|
|
- name: getPassword
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the password.'
|
|
- name: getUserInfo
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the user info.
|
|
|
|
# *
|
|
|
|
# * @return string|null A user name if any and, optionally, scheme-specific information
|
|
about how to gain authorization to access the server'
|
|
- name: getHttpHost
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the HTTP host being requested.
|
|
|
|
# *
|
|
|
|
# * The port name will be appended to the host if it''s non-standard.'
|
|
- name: getRequestUri
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the requested URI (path and query string).
|
|
|
|
# *
|
|
|
|
# * @return string The raw URI (i.e. not URI decoded)'
|
|
- name: getSchemeAndHttpHost
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the scheme and HTTP host.
|
|
|
|
# *
|
|
|
|
# * If the URL was called with basic authentication, the user
|
|
|
|
# * and the password are not added to the generated string.'
|
|
- name: getUri
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Generates a normalized URI (URL) for the Request.
|
|
|
|
# *
|
|
|
|
# * @see getQueryString()'
|
|
- name: getUriForPath
|
|
visibility: public
|
|
parameters:
|
|
- name: path
|
|
comment: '# * Generates a normalized URI for the given path.
|
|
|
|
# *
|
|
|
|
# * @param string $path A path to use instead of the current one'
|
|
- name: getRelativeUriForPath
|
|
visibility: public
|
|
parameters:
|
|
- name: path
|
|
comment: '# * Returns the path as relative reference from the current Request path.
|
|
|
|
# *
|
|
|
|
# * Only the URIs path component (no schema, host etc.) is relevant and must be
|
|
given.
|
|
|
|
# * Both paths must be absolute and not contain relative parts.
|
|
|
|
# * Relative URLs from one resource to another are useful when generating self-contained
|
|
downloadable document archives.
|
|
|
|
# * Furthermore, they can be used to reduce the link size in documents.
|
|
|
|
# *
|
|
|
|
# * Example target paths, given a base path of "/a/b/c/d":
|
|
|
|
# * - "/a/b/c/d" -> ""
|
|
|
|
# * - "/a/b/c/" -> "./"
|
|
|
|
# * - "/a/b/" -> "../"
|
|
|
|
# * - "/a/b/c/other" -> "other"
|
|
|
|
# * - "/a/x/y" -> "../../x/y"'
|
|
- name: getQueryString
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Generates the normalized query string for the Request.
|
|
|
|
# *
|
|
|
|
# * It builds a normalized query string, where keys/value pairs are alphabetized
|
|
|
|
# * and have consistent escaping.'
|
|
- name: isSecure
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether the request is secure or not.
|
|
|
|
# *
|
|
|
|
# * This method can read the client protocol from the "X-Forwarded-Proto" header
|
|
|
|
# * when trusted proxies were set via "setTrustedProxies()".
|
|
|
|
# *
|
|
|
|
# * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".'
|
|
- name: getHost
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the host name.
|
|
|
|
# *
|
|
|
|
# * This method can read the client host name from the "X-Forwarded-Host" header
|
|
|
|
# * when trusted proxies were set via "setTrustedProxies()".
|
|
|
|
# *
|
|
|
|
# * The "X-Forwarded-Host" header must contain the client host name.
|
|
|
|
# *
|
|
|
|
# * @throws SuspiciousOperationException when the host name is invalid or not
|
|
trusted'
|
|
- name: setMethod
|
|
visibility: public
|
|
parameters:
|
|
- name: method
|
|
comment: '# * Sets the request method.'
|
|
- name: getMethod
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the request "intended" method.
|
|
|
|
# *
|
|
|
|
# * If the X-HTTP-Method-Override header is set, and if the method is a POST,
|
|
|
|
# * then it is used to determine the "real" intended HTTP method.
|
|
|
|
# *
|
|
|
|
# * The _method request parameter can also be used to determine the HTTP method,
|
|
|
|
# * but only if enableHttpMethodParameterOverride() has been called.
|
|
|
|
# *
|
|
|
|
# * The method is always an uppercased string.
|
|
|
|
# *
|
|
|
|
# * @see getRealMethod()'
|
|
- name: getRealMethod
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the "real" request method.
|
|
|
|
# *
|
|
|
|
# * @see getMethod()'
|
|
- name: getMimeType
|
|
visibility: public
|
|
parameters:
|
|
- name: format
|
|
comment: '# * Gets the mime type associated with the format.'
|
|
- name: getMimeTypes
|
|
visibility: public
|
|
parameters:
|
|
- name: format
|
|
comment: '# * Gets the mime types associated with the format.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: getFormat
|
|
visibility: public
|
|
parameters:
|
|
- name: mimeType
|
|
comment: '# * Gets the format associated with the mime type.'
|
|
- name: setFormat
|
|
visibility: public
|
|
parameters:
|
|
- name: format
|
|
- name: mimeTypes
|
|
comment: '# * Associates a format with mime types.
|
|
|
|
# *
|
|
|
|
# * @param string|string[] $mimeTypes The associated mime types (the preferred
|
|
one must be the first as it will be used as the content type)'
|
|
- name: getRequestFormat
|
|
visibility: public
|
|
parameters:
|
|
- name: default
|
|
default: '''html'''
|
|
comment: '# * Gets the request format.
|
|
|
|
# *
|
|
|
|
# * Here is the process to determine the format:
|
|
|
|
# *
|
|
|
|
# * * format defined by the user (with setRequestFormat())
|
|
|
|
# * * _format request attribute
|
|
|
|
# * * $default
|
|
|
|
# *
|
|
|
|
# * @see getPreferredFormat'
|
|
- name: setRequestFormat
|
|
visibility: public
|
|
parameters:
|
|
- name: format
|
|
comment: '# * Sets the request format.'
|
|
- name: getContentTypeFormat
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the usual name of the format associated with the request''s media
|
|
type (provided in the Content-Type header).
|
|
|
|
# *
|
|
|
|
# * @see Request::$formats'
|
|
- name: setDefaultLocale
|
|
visibility: public
|
|
parameters:
|
|
- name: locale
|
|
comment: '# * Sets the default locale.'
|
|
- name: getDefaultLocale
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get the default locale.'
|
|
- name: setLocale
|
|
visibility: public
|
|
parameters:
|
|
- name: locale
|
|
comment: '# * Sets the locale.'
|
|
- name: getLocale
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get the locale.'
|
|
- name: isMethod
|
|
visibility: public
|
|
parameters:
|
|
- name: method
|
|
comment: '# * Checks if the request method is of specified type.
|
|
|
|
# *
|
|
|
|
# * @param string $method Uppercase request method (GET, POST etc)'
|
|
- name: isMethodSafe
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether or not the method is safe.
|
|
|
|
# *
|
|
|
|
# * @see https://tools.ietf.org/html/rfc7231#section-4.2.1'
|
|
- name: isMethodIdempotent
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether or not the method is idempotent.'
|
|
- name: isMethodCacheable
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether the method is cacheable or not.
|
|
|
|
# *
|
|
|
|
# * @see https://tools.ietf.org/html/rfc7231#section-4.2.3'
|
|
- name: getProtocolVersion
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns the protocol version.
|
|
|
|
# *
|
|
|
|
# * If the application is behind a proxy, the protocol version used in the
|
|
|
|
# * requests between the client and the proxy and between the proxy and the
|
|
|
|
# * server might be different. This returns the former (from the "Via" header)
|
|
|
|
# * if the proxy is trusted (see "setTrustedProxies()"), otherwise it returns
|
|
|
|
# * the latter (from the "SERVER_PROTOCOL" server parameter).'
|
|
- name: getContent
|
|
visibility: public
|
|
parameters:
|
|
- name: asResource
|
|
default: 'false'
|
|
comment: '# * Returns the request body content.
|
|
|
|
# *
|
|
|
|
# * @param bool $asResource If true, a resource will be returned
|
|
|
|
# *
|
|
|
|
# * @return string|resource
|
|
|
|
# *
|
|
|
|
# * @psalm-return ($asResource is true ? resource : string)'
|
|
- name: getPayload
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the decoded form or json request body.
|
|
|
|
# *
|
|
|
|
# * @throws JsonException When the body cannot be decoded to an array'
|
|
- name: toArray
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the request body decoded as array, typically from a JSON payload.
|
|
|
|
# *
|
|
|
|
# * @see getPayload() for portability between content types
|
|
|
|
# *
|
|
|
|
# * @throws JsonException When the body cannot be decoded to an array'
|
|
- name: getETags
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets the Etags.'
|
|
- name: isNoCache
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getPreferredFormat
|
|
visibility: public
|
|
parameters:
|
|
- name: default
|
|
default: '''html'''
|
|
comment: '# * Gets the preferred format for the response by inspecting, in the following
|
|
order:
|
|
|
|
# * * the request format set using setRequestFormat;
|
|
|
|
# * * the values of the Accept HTTP header.
|
|
|
|
# *
|
|
|
|
# * Note that if you use this method, you should send the "Vary: Accept" header
|
|
|
|
# * in the response to prevent any issues with intermediary HTTP caches.'
|
|
- name: getPreferredLanguage
|
|
visibility: public
|
|
parameters:
|
|
- name: locales
|
|
default: 'null'
|
|
comment: '# * Returns the preferred language.
|
|
|
|
# *
|
|
|
|
# * @param string[] $locales An array of ordered available locales'
|
|
- name: getLanguages
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets a list of languages acceptable by the client browser ordered
|
|
in the user browser preferences.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: formatLocale
|
|
visibility: private
|
|
parameters:
|
|
- name: locale
|
|
comment: '# * Strips the locale to only keep the canonicalized language value.
|
|
|
|
# *
|
|
|
|
# * Depending on the $locale value, this method can return values like :
|
|
|
|
# * - language_Script_REGION: "fr_Latn_FR", "zh_Hans_TW"
|
|
|
|
# * - language_Script: "fr_Latn", "zh_Hans"
|
|
|
|
# * - language_REGION: "fr_FR", "zh_TW"
|
|
|
|
# * - language: "fr", "zh"
|
|
|
|
# *
|
|
|
|
# * Invalid locale values are returned as is.
|
|
|
|
# *
|
|
|
|
# * @see https://wikipedia.org/wiki/IETF_language_tag
|
|
|
|
# * @see https://datatracker.ietf.org/doc/html/rfc5646'
|
|
- name: getLanguageCombinations
|
|
visibility: private
|
|
parameters:
|
|
- name: locale
|
|
comment: '# * Returns an array of all possible combinations of the language components.
|
|
|
|
# *
|
|
|
|
# * For instance, if the locale is "fr_Latn_FR", this method will return:
|
|
|
|
# * - "fr_Latn_FR"
|
|
|
|
# * - "fr_Latn"
|
|
|
|
# * - "fr_FR"
|
|
|
|
# * - "fr"
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: getLanguageComponents
|
|
visibility: private
|
|
parameters:
|
|
- name: locale
|
|
comment: '# * Returns an array with the language components of the locale.
|
|
|
|
# *
|
|
|
|
# * For example:
|
|
|
|
# * - If the locale is "fr_Latn_FR", this method will return "fr", "Latn", "FR"
|
|
|
|
# * - If the locale is "fr_FR", this method will return "fr", null, "FR"
|
|
|
|
# * - If the locale is "zh_Hans", this method will return "zh", "Hans", null
|
|
|
|
# *
|
|
|
|
# * @see https://wikipedia.org/wiki/IETF_language_tag
|
|
|
|
# * @see https://datatracker.ietf.org/doc/html/rfc5646
|
|
|
|
# *
|
|
|
|
# * @return array{string, string|null, string|null}'
|
|
- name: getCharsets
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets a list of charsets acceptable by the client browser in preferable
|
|
order.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: getEncodings
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets a list of encodings acceptable by the client browser in preferable
|
|
order.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: getAcceptableContentTypes
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Gets a list of content types acceptable by the client browser in preferable
|
|
order.
|
|
|
|
# *
|
|
|
|
# * @return string[]'
|
|
- name: isXmlHttpRequest
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Returns true if the request is an XMLHttpRequest.
|
|
|
|
# *
|
|
|
|
# * It works if your JavaScript library sets an X-Requested-With HTTP header.
|
|
|
|
# * It is known to work with common JavaScript frameworks:
|
|
|
|
# *
|
|
|
|
# * @see https://wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript'
|
|
- name: preferSafeContent
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Checks whether the client browser prefers safe content or not according
|
|
to RFC8674.
|
|
|
|
# *
|
|
|
|
# * @see https://tools.ietf.org/html/rfc8674'
|
|
- name: prepareRequestUri
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: prepareBaseUrl
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Prepares the base URL.'
|
|
- name: prepareBasePath
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Prepares the base path.'
|
|
- name: preparePathInfo
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Prepares the path info.'
|
|
- name: initializeFormats
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Initializes HTTP request formats.'
|
|
- name: setPhpDefaultLocale
|
|
visibility: private
|
|
parameters:
|
|
- name: locale
|
|
comment: null
|
|
- name: getUrlencodedPrefix
|
|
visibility: private
|
|
parameters:
|
|
- name: string
|
|
- name: prefix
|
|
comment: '# * Returns the prefix as encoded in the string when the string starts
|
|
with
|
|
|
|
# * the given prefix, null otherwise.'
|
|
- name: createRequestFromFactory
|
|
visibility: private
|
|
parameters:
|
|
- name: query
|
|
default: '[]'
|
|
- name: request
|
|
default: '[]'
|
|
- name: attributes
|
|
default: '[]'
|
|
- name: cookies
|
|
default: '[]'
|
|
- name: files
|
|
default: '[]'
|
|
- name: server
|
|
default: '[]'
|
|
- name: content
|
|
default: 'null'
|
|
comment: null
|
|
- name: isFromTrustedProxy
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Indicates whether this request originated from a trusted proxy.
|
|
|
|
# *
|
|
|
|
# * This can be useful to determine whether or not to trust the
|
|
|
|
# * contents of a proxy-specific header.'
|
|
- name: getTrustedValues
|
|
visibility: private
|
|
parameters:
|
|
- name: type
|
|
- name: ip
|
|
default: 'null'
|
|
comment: '# * This method is rather heavy because it splits and merges headers,
|
|
and it''s called by many other methods such as
|
|
|
|
# * getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus,
|
|
we try to cache the results for
|
|
|
|
# * best performance.'
|
|
- name: normalizeAndFilterClientIps
|
|
visibility: private
|
|
parameters:
|
|
- name: clientIps
|
|
- name: ip
|
|
comment: null
|
|
- name: isIisRewrite
|
|
visibility: private
|
|
parameters: []
|
|
comment: '# * Is this IIS with UrlRewriteModule?
|
|
|
|
# *
|
|
|
|
# * This method consumes, caches and removed the IIS_WasUrlRewritten env var,
|
|
|
|
# * so we don''t inherit it to sub-requests.'
|
|
traits:
|
|
- Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
|
|
- Symfony\Component\HttpFoundation\Exception\JsonException
|
|
- Symfony\Component\HttpFoundation\Exception\SessionNotFoundException
|
|
- Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException
|
|
- Symfony\Component\HttpFoundation\Session\SessionInterface
|
|
interfaces: []
|