X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FRequest.php;h=d61303d5d729f410c8776aec4d534f04e53629b1;hb=e659a0314086dd700dbe5e754e383ab758725805;hp=43cabba856e513e76b39c0c4f7df14e491251e7a;hpb=12ba37e8d2a3125ed316d35bc4ca5ca7f52d1bdf;p=friendica.git diff --git a/src/App/Request.php b/src/App/Request.php index 43cabba856..d61303d5d7 100644 --- a/src/App/Request.php +++ b/src/App/Request.php @@ -1,6 +1,6 @@ remoteAddress; } + /** + * @return string The request ID of the current request + * + * Do always use this instead of $_SERVER['X_REQUEST_ID'] + */ + public function getRequestId(): string + { + return $this->requestId; + } + public function __construct(IManageConfigValues $config, array $server = []) { $this->remoteAddress = $this->determineRemoteAddress($config, $server); + $this->requestId = $server[static::DEFAULT_REQUEST_ID_HEADER] ?? System::createGUID(8, false); } /** @@ -108,7 +132,7 @@ class Request * specified in this header will be returned instead. * * @param IManageConfigValues $config - * @param array $server + * @param array $server The $_SERVER array * * @return string */ @@ -118,7 +142,7 @@ class Request $trustedProxies = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'trusted_proxies', '')); if (\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) { - $forwardedForHeaders = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'forwarded_for_headers')) ?? static::ORDERED_FORWARD_FOR_HEADER; + $forwardedForHeaders = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'forwarded_for_headers', static::DEFAULT_FORWARD_FOR_HEADER)); foreach ($forwardedForHeaders as $header) { if (isset($server[$header])) {