|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / a / home / dev2.destoffenstraat.com / vendor / magento / framework / HTTP / |
Filename | /home/a/home/dev2.destoffenstraat.com/vendor/magento/framework/HTTP/Header.php |
Size | 2.92 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 07-Jan-2021 21:08 |
Last accessed | 22-Aug-2025 21:39 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\HTTP;
/**
* Library for working with HTTP headers
*/
class Header
{
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\Stdlib\StringUtils
*/
protected $_converter;
/**
* @param \Magento\Framework\App\RequestInterface $httpRequest
* @param \Magento\Framework\Stdlib\StringUtils $converter
*/
public function __construct(
\Magento\Framework\App\RequestInterface $httpRequest,
\Magento\Framework\Stdlib\StringUtils $converter
) {
$this->_request = $httpRequest;
$this->_converter = $converter;
}
/**
* Retrieve HTTP HOST
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpHost($clean = true)
{
return $this->_getHttpCleanValue('HTTP_HOST', $clean);
}
/**
* Retrieve HTTP USER AGENT
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpUserAgent($clean = true)
{
return $this->_getHttpCleanValue('HTTP_USER_AGENT', $clean);
}
/**
* Retrieve HTTP ACCEPT LANGUAGE
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpAcceptLanguage($clean = true)
{
return $this->_getHttpCleanValue('HTTP_ACCEPT_LANGUAGE', $clean);
}
/**
* Retrieve HTTP ACCEPT CHARSET
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpAcceptCharset($clean = true)
{
return $this->_getHttpCleanValue('HTTP_ACCEPT_CHARSET', $clean);
}
/**
* Retrieve HTTP REFERER
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpReferer($clean = true)
{
return $this->_getHttpCleanValue('HTTP_REFERER', $clean);
}
/**
* Returns the REQUEST_URI taking into account
* platform differences between Apache and IIS
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getRequestUri($clean = false)
{
$uri = $this->_request->getRequestUri();
if ($clean) {
$uri = $this->_converter->cleanString($uri);
}
return $uri;
}
/**
* Retrieve HTTP "clean" value
*
* @param string $var
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
protected function _getHttpCleanValue($var, $clean = true)
{
$value = $this->_request->getServer($var, '');
if ($clean) {
$value = $this->_converter->cleanString($value);
}
return $value;
}
}
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\HTTP;
/**
* Library for working with HTTP headers
*/
class Header
{
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\Stdlib\StringUtils
*/
protected $_converter;
/**
* @param \Magento\Framework\App\RequestInterface $httpRequest
* @param \Magento\Framework\Stdlib\StringUtils $converter
*/
public function __construct(
\Magento\Framework\App\RequestInterface $httpRequest,
\Magento\Framework\Stdlib\StringUtils $converter
) {
$this->_request = $httpRequest;
$this->_converter = $converter;
}
/**
* Retrieve HTTP HOST
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpHost($clean = true)
{
return $this->_getHttpCleanValue('HTTP_HOST', $clean);
}
/**
* Retrieve HTTP USER AGENT
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpUserAgent($clean = true)
{
return $this->_getHttpCleanValue('HTTP_USER_AGENT', $clean);
}
/**
* Retrieve HTTP ACCEPT LANGUAGE
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpAcceptLanguage($clean = true)
{
return $this->_getHttpCleanValue('HTTP_ACCEPT_LANGUAGE', $clean);
}
/**
* Retrieve HTTP ACCEPT CHARSET
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpAcceptCharset($clean = true)
{
return $this->_getHttpCleanValue('HTTP_ACCEPT_CHARSET', $clean);
}
/**
* Retrieve HTTP REFERER
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getHttpReferer($clean = true)
{
return $this->_getHttpCleanValue('HTTP_REFERER', $clean);
}
/**
* Returns the REQUEST_URI taking into account
* platform differences between Apache and IIS
*
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
public function getRequestUri($clean = false)
{
$uri = $this->_request->getRequestUri();
if ($clean) {
$uri = $this->_converter->cleanString($uri);
}
return $uri;
}
/**
* Retrieve HTTP "clean" value
*
* @param string $var
* @param boolean $clean clean non UTF-8 characters
* @return string
*/
protected function _getHttpCleanValue($var, $clean = true)
{
$value = $this->_request->getServer($var, '');
if ($clean) {
$value = $this->_converter->cleanString($value);
}
return $value;
}
}